monday-cli 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 (596) hide show
  1. package/CHANGELOG.md +439 -0
  2. package/LICENSE +21 -0
  3. package/README.md +431 -0
  4. package/dist/api/board-child-finder.d.ts +95 -0
  5. package/dist/api/board-child-finder.d.ts.map +1 -0
  6. package/dist/api/board-child-finder.js +89 -0
  7. package/dist/api/board-child-finder.js.map +1 -0
  8. package/dist/api/board-metadata.d.ts +162 -0
  9. package/dist/api/board-metadata.d.ts.map +1 -0
  10. package/dist/api/board-metadata.js +238 -0
  11. package/dist/api/board-metadata.js.map +1 -0
  12. package/dist/api/board-mutation-invalidation.d.ts +153 -0
  13. package/dist/api/board-mutation-invalidation.d.ts.map +1 -0
  14. package/dist/api/board-mutation-invalidation.js +136 -0
  15. package/dist/api/board-mutation-invalidation.js.map +1 -0
  16. package/dist/api/board-mutation-result.d.ts +97 -0
  17. package/dist/api/board-mutation-result.d.ts.map +1 -0
  18. package/dist/api/board-mutation-result.js +99 -0
  19. package/dist/api/board-mutation-result.js.map +1 -0
  20. package/dist/api/board-projection.d.ts +68 -0
  21. package/dist/api/board-projection.d.ts.map +1 -0
  22. package/dist/api/board-projection.js +79 -0
  23. package/dist/api/board-projection.js.map +1 -0
  24. package/dist/api/cache.d.ts +150 -0
  25. package/dist/api/cache.d.ts.map +1 -0
  26. package/dist/api/cache.js +418 -0
  27. package/dist/api/cache.js.map +1 -0
  28. package/dist/api/client.d.ts +162 -0
  29. package/dist/api/client.d.ts.map +1 -0
  30. package/dist/api/client.js +205 -0
  31. package/dist/api/client.js.map +1 -0
  32. package/dist/api/column-mapping.d.ts +68 -0
  33. package/dist/api/column-mapping.d.ts.map +1 -0
  34. package/dist/api/column-mapping.js +117 -0
  35. package/dist/api/column-mapping.js.map +1 -0
  36. package/dist/api/column-mutation-result.d.ts +136 -0
  37. package/dist/api/column-mutation-result.d.ts.map +1 -0
  38. package/dist/api/column-mutation-result.js +130 -0
  39. package/dist/api/column-mutation-result.js.map +1 -0
  40. package/dist/api/column-types.d.ts +215 -0
  41. package/dist/api/column-types.d.ts.map +1 -0
  42. package/dist/api/column-types.js +195 -0
  43. package/dist/api/column-types.js.map +1 -0
  44. package/dist/api/column-values.d.ts +446 -0
  45. package/dist/api/column-values.d.ts.map +1 -0
  46. package/dist/api/column-values.js +795 -0
  47. package/dist/api/column-values.js.map +1 -0
  48. package/dist/api/columns.d.ts +205 -0
  49. package/dist/api/columns.d.ts.map +1 -0
  50. package/dist/api/columns.js +343 -0
  51. package/dist/api/columns.js.map +1 -0
  52. package/dist/api/complexity.d.ts +90 -0
  53. package/dist/api/complexity.d.ts.map +1 -0
  54. package/dist/api/complexity.js +194 -0
  55. package/dist/api/complexity.js.map +1 -0
  56. package/dist/api/dates.d.ts +150 -0
  57. package/dist/api/dates.d.ts.map +1 -0
  58. package/dist/api/dates.js +490 -0
  59. package/dist/api/dates.js.map +1 -0
  60. package/dist/api/destructive-gate.d.ts +107 -0
  61. package/dist/api/destructive-gate.d.ts.map +1 -0
  62. package/dist/api/destructive-gate.js +19 -0
  63. package/dist/api/destructive-gate.js.map +1 -0
  64. package/dist/api/dry-run.d.ts +338 -0
  65. package/dist/api/dry-run.d.ts.map +1 -0
  66. package/dist/api/dry-run.js +607 -0
  67. package/dist/api/dry-run.js.map +1 -0
  68. package/dist/api/emails.d.ts +60 -0
  69. package/dist/api/emails.d.ts.map +1 -0
  70. package/dist/api/emails.js +113 -0
  71. package/dist/api/emails.js.map +1 -0
  72. package/dist/api/errors.d.ts +82 -0
  73. package/dist/api/errors.d.ts.map +1 -0
  74. package/dist/api/errors.js +434 -0
  75. package/dist/api/errors.js.map +1 -0
  76. package/dist/api/filters.d.ts +198 -0
  77. package/dist/api/filters.d.ts.map +1 -0
  78. package/dist/api/filters.js +328 -0
  79. package/dist/api/filters.js.map +1 -0
  80. package/dist/api/group-color.d.ts +33 -0
  81. package/dist/api/group-color.d.ts.map +1 -0
  82. package/dist/api/group-color.js +80 -0
  83. package/dist/api/group-color.js.map +1 -0
  84. package/dist/api/group-mutation-result.d.ts +150 -0
  85. package/dist/api/group-mutation-result.d.ts.map +1 -0
  86. package/dist/api/group-mutation-result.js +141 -0
  87. package/dist/api/group-mutation-result.js.map +1 -0
  88. package/dist/api/iso-country-codes.d.ts +45 -0
  89. package/dist/api/iso-country-codes.d.ts.map +1 -0
  90. package/dist/api/iso-country-codes.js +71 -0
  91. package/dist/api/iso-country-codes.js.map +1 -0
  92. package/dist/api/item-board-lookup.d.ts +86 -0
  93. package/dist/api/item-board-lookup.d.ts.map +1 -0
  94. package/dist/api/item-board-lookup.js +140 -0
  95. package/dist/api/item-board-lookup.js.map +1 -0
  96. package/dist/api/item-helpers.d.ts +133 -0
  97. package/dist/api/item-helpers.d.ts.map +1 -0
  98. package/dist/api/item-helpers.js +139 -0
  99. package/dist/api/item-helpers.js.map +1 -0
  100. package/dist/api/item-mutation-result.d.ts +60 -0
  101. package/dist/api/item-mutation-result.d.ts.map +1 -0
  102. package/dist/api/item-mutation-result.js +63 -0
  103. package/dist/api/item-mutation-result.js.map +1 -0
  104. package/dist/api/item-projection.d.ts +165 -0
  105. package/dist/api/item-projection.d.ts.map +1 -0
  106. package/dist/api/item-projection.js +235 -0
  107. package/dist/api/item-projection.js.map +1 -0
  108. package/dist/api/item-source-read.d.ts +45 -0
  109. package/dist/api/item-source-read.d.ts.map +1 -0
  110. package/dist/api/item-source-read.js +57 -0
  111. package/dist/api/item-source-read.js.map +1 -0
  112. package/dist/api/items-page-walker.d.ts +126 -0
  113. package/dist/api/items-page-walker.d.ts.map +1 -0
  114. package/dist/api/items-page-walker.js +256 -0
  115. package/dist/api/items-page-walker.js.map +1 -0
  116. package/dist/api/links.d.ts +70 -0
  117. package/dist/api/links.d.ts.map +1 -0
  118. package/dist/api/links.js +128 -0
  119. package/dist/api/links.js.map +1 -0
  120. package/dist/api/me-token.d.ts +52 -0
  121. package/dist/api/me-token.d.ts.map +1 -0
  122. package/dist/api/me-token.js +55 -0
  123. package/dist/api/me-token.js.map +1 -0
  124. package/dist/api/pagination.d.ts +201 -0
  125. package/dist/api/pagination.d.ts.map +1 -0
  126. package/dist/api/pagination.js +223 -0
  127. package/dist/api/pagination.js.map +1 -0
  128. package/dist/api/partial-success-mutation.d.ts +28 -0
  129. package/dist/api/partial-success-mutation.d.ts.map +1 -0
  130. package/dist/api/partial-success-mutation.js +68 -0
  131. package/dist/api/partial-success-mutation.js.map +1 -0
  132. package/dist/api/people.d.ts +182 -0
  133. package/dist/api/people.d.ts.map +1 -0
  134. package/dist/api/people.js +260 -0
  135. package/dist/api/people.js.map +1 -0
  136. package/dist/api/phones.d.ts +74 -0
  137. package/dist/api/phones.d.ts.map +1 -0
  138. package/dist/api/phones.js +167 -0
  139. package/dist/api/phones.js.map +1 -0
  140. package/dist/api/raw-document.d.ts +53 -0
  141. package/dist/api/raw-document.d.ts.map +1 -0
  142. package/dist/api/raw-document.js +177 -0
  143. package/dist/api/raw-document.js.map +1 -0
  144. package/dist/api/raw-write.d.ts +127 -0
  145. package/dist/api/raw-write.d.ts.map +1 -0
  146. package/dist/api/raw-write.js +233 -0
  147. package/dist/api/raw-write.js.map +1 -0
  148. package/dist/api/resolution-context.d.ts +32 -0
  149. package/dist/api/resolution-context.d.ts.map +1 -0
  150. package/dist/api/resolution-context.js +42 -0
  151. package/dist/api/resolution-context.js.map +1 -0
  152. package/dist/api/resolution-pass.d.ts +163 -0
  153. package/dist/api/resolution-pass.d.ts.map +1 -0
  154. package/dist/api/resolution-pass.js +254 -0
  155. package/dist/api/resolution-pass.js.map +1 -0
  156. package/dist/api/resolve-client.d.ts +69 -0
  157. package/dist/api/resolve-client.d.ts.map +1 -0
  158. package/dist/api/resolve-client.js +70 -0
  159. package/dist/api/resolve-client.js.map +1 -0
  160. package/dist/api/resolver-error-fold.d.ts +176 -0
  161. package/dist/api/resolver-error-fold.d.ts.map +1 -0
  162. package/dist/api/resolver-error-fold.js +230 -0
  163. package/dist/api/resolver-error-fold.js.map +1 -0
  164. package/dist/api/resolvers.d.ts +131 -0
  165. package/dist/api/resolvers.d.ts.map +1 -0
  166. package/dist/api/resolvers.js +262 -0
  167. package/dist/api/resolvers.js.map +1 -0
  168. package/dist/api/response-root.d.ts +65 -0
  169. package/dist/api/response-root.d.ts.map +1 -0
  170. package/dist/api/response-root.js +61 -0
  171. package/dist/api/response-root.js.map +1 -0
  172. package/dist/api/retry.d.ts +112 -0
  173. package/dist/api/retry.d.ts.map +1 -0
  174. package/dist/api/retry.js +181 -0
  175. package/dist/api/retry.js.map +1 -0
  176. package/dist/api/set-expression.d.ts +23 -0
  177. package/dist/api/set-expression.d.ts.map +1 -0
  178. package/dist/api/set-expression.js +31 -0
  179. package/dist/api/set-expression.js.map +1 -0
  180. package/dist/api/sort.d.ts +59 -0
  181. package/dist/api/sort.d.ts.map +1 -0
  182. package/dist/api/sort.js +73 -0
  183. package/dist/api/sort.js.map +1 -0
  184. package/dist/api/source-aggregator.d.ts +94 -0
  185. package/dist/api/source-aggregator.d.ts.map +1 -0
  186. package/dist/api/source-aggregator.js +111 -0
  187. package/dist/api/source-aggregator.js.map +1 -0
  188. package/dist/api/transport.d.ts +58 -0
  189. package/dist/api/transport.d.ts.map +1 -0
  190. package/dist/api/transport.js +190 -0
  191. package/dist/api/transport.js.map +1 -0
  192. package/dist/api/update-mutation-result.d.ts +133 -0
  193. package/dist/api/update-mutation-result.d.ts.map +1 -0
  194. package/dist/api/update-mutation-result.js +145 -0
  195. package/dist/api/update-mutation-result.js.map +1 -0
  196. package/dist/api/users-fan-out-mutation.d.ts +124 -0
  197. package/dist/api/users-fan-out-mutation.d.ts.map +1 -0
  198. package/dist/api/users-fan-out-mutation.js +331 -0
  199. package/dist/api/users-fan-out-mutation.js.map +1 -0
  200. package/dist/api/walk-pages.d.ts +91 -0
  201. package/dist/api/walk-pages.d.ts.map +1 -0
  202. package/dist/api/walk-pages.js +84 -0
  203. package/dist/api/walk-pages.js.map +1 -0
  204. package/dist/api/workspace-projection.d.ts +64 -0
  205. package/dist/api/workspace-projection.d.ts.map +1 -0
  206. package/dist/api/workspace-projection.js +83 -0
  207. package/dist/api/workspace-projection.js.map +1 -0
  208. package/dist/cli/envelope-out.d.ts +128 -0
  209. package/dist/cli/envelope-out.d.ts.map +1 -0
  210. package/dist/cli/envelope-out.js +146 -0
  211. package/dist/cli/envelope-out.js.map +1 -0
  212. package/dist/cli/index.d.ts +3 -0
  213. package/dist/cli/index.d.ts.map +1 -0
  214. package/dist/cli/index.js +27 -0
  215. package/dist/cli/index.js.map +1 -0
  216. package/dist/cli/program.d.ts +29 -0
  217. package/dist/cli/program.d.ts.map +1 -0
  218. package/dist/cli/program.js +109 -0
  219. package/dist/cli/program.js.map +1 -0
  220. package/dist/cli/run.d.ts +108 -0
  221. package/dist/cli/run.d.ts.map +1 -0
  222. package/dist/cli/run.js +105 -0
  223. package/dist/cli/run.js.map +1 -0
  224. package/dist/commands/account/client-helper.d.ts +37 -0
  225. package/dist/commands/account/client-helper.d.ts.map +1 -0
  226. package/dist/commands/account/client-helper.js +55 -0
  227. package/dist/commands/account/client-helper.js.map +1 -0
  228. package/dist/commands/account/complexity.d.ts +29 -0
  229. package/dist/commands/account/complexity.d.ts.map +1 -0
  230. package/dist/commands/account/complexity.js +70 -0
  231. package/dist/commands/account/complexity.js.map +1 -0
  232. package/dist/commands/account/info.d.ts +36 -0
  233. package/dist/commands/account/info.d.ts.map +1 -0
  234. package/dist/commands/account/info.js +74 -0
  235. package/dist/commands/account/info.js.map +1 -0
  236. package/dist/commands/account/version.d.ts +44 -0
  237. package/dist/commands/account/version.d.ts.map +1 -0
  238. package/dist/commands/account/version.js +98 -0
  239. package/dist/commands/account/version.js.map +1 -0
  240. package/dist/commands/account/whoami.d.ts +34 -0
  241. package/dist/commands/account/whoami.d.ts.map +1 -0
  242. package/dist/commands/account/whoami.js +77 -0
  243. package/dist/commands/account/whoami.js.map +1 -0
  244. package/dist/commands/board/add-users.d.ts +60 -0
  245. package/dist/commands/board/add-users.d.ts.map +1 -0
  246. package/dist/commands/board/add-users.js +133 -0
  247. package/dist/commands/board/add-users.js.map +1 -0
  248. package/dist/commands/board/archive.d.ts +64 -0
  249. package/dist/commands/board/archive.d.ts.map +1 -0
  250. package/dist/commands/board/archive.js +226 -0
  251. package/dist/commands/board/archive.js.map +1 -0
  252. package/dist/commands/board/column-create.d.ts +146 -0
  253. package/dist/commands/board/column-create.d.ts.map +1 -0
  254. package/dist/commands/board/column-create.js +564 -0
  255. package/dist/commands/board/column-create.js.map +1 -0
  256. package/dist/commands/board/column-delete.d.ts +76 -0
  257. package/dist/commands/board/column-delete.d.ts.map +1 -0
  258. package/dist/commands/board/column-delete.js +224 -0
  259. package/dist/commands/board/column-delete.js.map +1 -0
  260. package/dist/commands/board/column-update.d.ts +92 -0
  261. package/dist/commands/board/column-update.d.ts.map +1 -0
  262. package/dist/commands/board/column-update.js +364 -0
  263. package/dist/commands/board/column-update.js.map +1 -0
  264. package/dist/commands/board/columns.d.ts +30 -0
  265. package/dist/commands/board/columns.d.ts.map +1 -0
  266. package/dist/commands/board/columns.js +102 -0
  267. package/dist/commands/board/columns.js.map +1 -0
  268. package/dist/commands/board/create.d.ts +67 -0
  269. package/dist/commands/board/create.d.ts.map +1 -0
  270. package/dist/commands/board/create.js +226 -0
  271. package/dist/commands/board/create.js.map +1 -0
  272. package/dist/commands/board/delete.d.ts +60 -0
  273. package/dist/commands/board/delete.d.ts.map +1 -0
  274. package/dist/commands/board/delete.js +192 -0
  275. package/dist/commands/board/delete.js.map +1 -0
  276. package/dist/commands/board/describe.d.ts +68 -0
  277. package/dist/commands/board/describe.d.ts.map +1 -0
  278. package/dist/commands/board/describe.js +241 -0
  279. package/dist/commands/board/describe.js.map +1 -0
  280. package/dist/commands/board/doctor.d.ts +108 -0
  281. package/dist/commands/board/doctor.d.ts.map +1 -0
  282. package/dist/commands/board/doctor.js +417 -0
  283. package/dist/commands/board/doctor.js.map +1 -0
  284. package/dist/commands/board/duplicate.d.ts +85 -0
  285. package/dist/commands/board/duplicate.d.ts.map +1 -0
  286. package/dist/commands/board/duplicate.js +281 -0
  287. package/dist/commands/board/duplicate.js.map +1 -0
  288. package/dist/commands/board/find.d.ts +47 -0
  289. package/dist/commands/board/find.d.ts.map +1 -0
  290. package/dist/commands/board/find.js +153 -0
  291. package/dist/commands/board/find.js.map +1 -0
  292. package/dist/commands/board/get.d.ts +41 -0
  293. package/dist/commands/board/get.d.ts.map +1 -0
  294. package/dist/commands/board/get.js +66 -0
  295. package/dist/commands/board/get.js.map +1 -0
  296. package/dist/commands/board/group-archive.d.ts +83 -0
  297. package/dist/commands/board/group-archive.d.ts.map +1 -0
  298. package/dist/commands/board/group-archive.js +264 -0
  299. package/dist/commands/board/group-archive.js.map +1 -0
  300. package/dist/commands/board/group-create.d.ts +118 -0
  301. package/dist/commands/board/group-create.d.ts.map +1 -0
  302. package/dist/commands/board/group-create.js +239 -0
  303. package/dist/commands/board/group-create.js.map +1 -0
  304. package/dist/commands/board/group-delete.d.ts +79 -0
  305. package/dist/commands/board/group-delete.d.ts.map +1 -0
  306. package/dist/commands/board/group-delete.js +222 -0
  307. package/dist/commands/board/group-delete.js.map +1 -0
  308. package/dist/commands/board/group-duplicate.d.ts +70 -0
  309. package/dist/commands/board/group-duplicate.d.ts.map +1 -0
  310. package/dist/commands/board/group-duplicate.js +219 -0
  311. package/dist/commands/board/group-duplicate.js.map +1 -0
  312. package/dist/commands/board/group-update.d.ts +145 -0
  313. package/dist/commands/board/group-update.d.ts.map +1 -0
  314. package/dist/commands/board/group-update.js +341 -0
  315. package/dist/commands/board/group-update.js.map +1 -0
  316. package/dist/commands/board/groups.d.ts +28 -0
  317. package/dist/commands/board/groups.d.ts.map +1 -0
  318. package/dist/commands/board/groups.js +85 -0
  319. package/dist/commands/board/groups.js.map +1 -0
  320. package/dist/commands/board/list.d.ts +39 -0
  321. package/dist/commands/board/list.d.ts.map +1 -0
  322. package/dist/commands/board/list.js +135 -0
  323. package/dist/commands/board/list.js.map +1 -0
  324. package/dist/commands/board/subscribers.d.ts +24 -0
  325. package/dist/commands/board/subscribers.d.ts.map +1 -0
  326. package/dist/commands/board/subscribers.js +89 -0
  327. package/dist/commands/board/subscribers.js.map +1 -0
  328. package/dist/commands/board/update.d.ts +82 -0
  329. package/dist/commands/board/update.d.ts.map +1 -0
  330. package/dist/commands/board/update.js +328 -0
  331. package/dist/commands/board/update.js.map +1 -0
  332. package/dist/commands/cache/clear.d.ts +34 -0
  333. package/dist/commands/cache/clear.d.ts.map +1 -0
  334. package/dist/commands/cache/clear.js +113 -0
  335. package/dist/commands/cache/clear.js.map +1 -0
  336. package/dist/commands/cache/list.d.ts +50 -0
  337. package/dist/commands/cache/list.d.ts.map +1 -0
  338. package/dist/commands/cache/list.js +77 -0
  339. package/dist/commands/cache/list.js.map +1 -0
  340. package/dist/commands/cache/stats.d.ts +22 -0
  341. package/dist/commands/cache/stats.d.ts.map +1 -0
  342. package/dist/commands/cache/stats.js +56 -0
  343. package/dist/commands/cache/stats.js.map +1 -0
  344. package/dist/commands/config/path.d.ts +22 -0
  345. package/dist/commands/config/path.d.ts.map +1 -0
  346. package/dist/commands/config/path.js +74 -0
  347. package/dist/commands/config/path.js.map +1 -0
  348. package/dist/commands/config/show.d.ts +61 -0
  349. package/dist/commands/config/show.d.ts.map +1 -0
  350. package/dist/commands/config/show.js +137 -0
  351. package/dist/commands/config/show.js.map +1 -0
  352. package/dist/commands/emit.d.ts +156 -0
  353. package/dist/commands/emit.d.ts.map +1 -0
  354. package/dist/commands/emit.js +212 -0
  355. package/dist/commands/emit.js.map +1 -0
  356. package/dist/commands/index.d.ts +5 -0
  357. package/dist/commands/index.d.ts.map +1 -0
  358. package/dist/commands/index.js +195 -0
  359. package/dist/commands/index.js.map +1 -0
  360. package/dist/commands/item/archive.d.ts +81 -0
  361. package/dist/commands/item/archive.d.ts.map +1 -0
  362. package/dist/commands/item/archive.js +187 -0
  363. package/dist/commands/item/archive.js.map +1 -0
  364. package/dist/commands/item/clear.d.ts +140 -0
  365. package/dist/commands/item/clear.d.ts.map +1 -0
  366. package/dist/commands/item/clear.js +748 -0
  367. package/dist/commands/item/clear.js.map +1 -0
  368. package/dist/commands/item/create.d.ts +77 -0
  369. package/dist/commands/item/create.d.ts.map +1 -0
  370. package/dist/commands/item/create.js +802 -0
  371. package/dist/commands/item/create.js.map +1 -0
  372. package/dist/commands/item/delete.d.ts +82 -0
  373. package/dist/commands/item/delete.d.ts.map +1 -0
  374. package/dist/commands/item/delete.js +179 -0
  375. package/dist/commands/item/delete.js.map +1 -0
  376. package/dist/commands/item/duplicate.d.ts +117 -0
  377. package/dist/commands/item/duplicate.d.ts.map +1 -0
  378. package/dist/commands/item/duplicate.js +238 -0
  379. package/dist/commands/item/duplicate.js.map +1 -0
  380. package/dist/commands/item/find.d.ts +55 -0
  381. package/dist/commands/item/find.d.ts.map +1 -0
  382. package/dist/commands/item/find.js +231 -0
  383. package/dist/commands/item/find.js.map +1 -0
  384. package/dist/commands/item/get.d.ts +47 -0
  385. package/dist/commands/item/get.d.ts.map +1 -0
  386. package/dist/commands/item/get.js +66 -0
  387. package/dist/commands/item/get.js.map +1 -0
  388. package/dist/commands/item/list.d.ts +73 -0
  389. package/dist/commands/item/list.d.ts.map +1 -0
  390. package/dist/commands/item/list.js +284 -0
  391. package/dist/commands/item/list.js.map +1 -0
  392. package/dist/commands/item/move.d.ts +181 -0
  393. package/dist/commands/item/move.d.ts.map +1 -0
  394. package/dist/commands/item/move.js +560 -0
  395. package/dist/commands/item/move.js.map +1 -0
  396. package/dist/commands/item/search.d.ts +67 -0
  397. package/dist/commands/item/search.d.ts.map +1 -0
  398. package/dist/commands/item/search.js +322 -0
  399. package/dist/commands/item/search.js.map +1 -0
  400. package/dist/commands/item/set.d.ts +88 -0
  401. package/dist/commands/item/set.d.ts.map +1 -0
  402. package/dist/commands/item/set.js +387 -0
  403. package/dist/commands/item/set.js.map +1 -0
  404. package/dist/commands/item/subitems.d.ts +50 -0
  405. package/dist/commands/item/subitems.d.ts.map +1 -0
  406. package/dist/commands/item/subitems.js +86 -0
  407. package/dist/commands/item/subitems.js.map +1 -0
  408. package/dist/commands/item/update.d.ts +99 -0
  409. package/dist/commands/item/update.d.ts.map +1 -0
  410. package/dist/commands/item/update.js +884 -0
  411. package/dist/commands/item/update.js.map +1 -0
  412. package/dist/commands/item/upsert.d.ts +105 -0
  413. package/dist/commands/item/upsert.d.ts.map +1 -0
  414. package/dist/commands/item/upsert.js +998 -0
  415. package/dist/commands/item/upsert.js.map +1 -0
  416. package/dist/commands/parse-argv.d.ts +20 -0
  417. package/dist/commands/parse-argv.d.ts.map +1 -0
  418. package/dist/commands/parse-argv.js +40 -0
  419. package/dist/commands/parse-argv.js.map +1 -0
  420. package/dist/commands/raw/index.d.ts +23 -0
  421. package/dist/commands/raw/index.d.ts.map +1 -0
  422. package/dist/commands/raw/index.js +416 -0
  423. package/dist/commands/raw/index.js.map +1 -0
  424. package/dist/commands/run-by-id-lookup.d.ts +72 -0
  425. package/dist/commands/run-by-id-lookup.d.ts.map +1 -0
  426. package/dist/commands/run-by-id-lookup.js +58 -0
  427. package/dist/commands/run-by-id-lookup.js.map +1 -0
  428. package/dist/commands/schema/index.d.ts +104 -0
  429. package/dist/commands/schema/index.d.ts.map +1 -0
  430. package/dist/commands/schema/index.js +183 -0
  431. package/dist/commands/schema/index.js.map +1 -0
  432. package/dist/commands/types.d.ts +66 -0
  433. package/dist/commands/types.d.ts.map +1 -0
  434. package/dist/commands/types.js +15 -0
  435. package/dist/commands/types.js.map +1 -0
  436. package/dist/commands/update/body-source.d.ts +38 -0
  437. package/dist/commands/update/body-source.d.ts.map +1 -0
  438. package/dist/commands/update/body-source.js +80 -0
  439. package/dist/commands/update/body-source.js.map +1 -0
  440. package/dist/commands/update/clear-all.d.ts +67 -0
  441. package/dist/commands/update/clear-all.d.ts.map +1 -0
  442. package/dist/commands/update/clear-all.js +281 -0
  443. package/dist/commands/update/clear-all.js.map +1 -0
  444. package/dist/commands/update/create.d.ts +51 -0
  445. package/dist/commands/update/create.d.ts.map +1 -0
  446. package/dist/commands/update/create.js +167 -0
  447. package/dist/commands/update/create.js.map +1 -0
  448. package/dist/commands/update/delete.d.ts +53 -0
  449. package/dist/commands/update/delete.d.ts.map +1 -0
  450. package/dist/commands/update/delete.js +148 -0
  451. package/dist/commands/update/delete.js.map +1 -0
  452. package/dist/commands/update/edit.d.ts +37 -0
  453. package/dist/commands/update/edit.d.ts.map +1 -0
  454. package/dist/commands/update/edit.js +129 -0
  455. package/dist/commands/update/edit.js.map +1 -0
  456. package/dist/commands/update/get.d.ts +37 -0
  457. package/dist/commands/update/get.d.ts.map +1 -0
  458. package/dist/commands/update/get.js +92 -0
  459. package/dist/commands/update/get.js.map +1 -0
  460. package/dist/commands/update/like.d.ts +17 -0
  461. package/dist/commands/update/like.d.ts.map +1 -0
  462. package/dist/commands/update/like.js +23 -0
  463. package/dist/commands/update/like.js.map +1 -0
  464. package/dist/commands/update/list.d.ts +58 -0
  465. package/dist/commands/update/list.d.ts.map +1 -0
  466. package/dist/commands/update/list.js +322 -0
  467. package/dist/commands/update/list.js.map +1 -0
  468. package/dist/commands/update/pin.d.ts +17 -0
  469. package/dist/commands/update/pin.d.ts.map +1 -0
  470. package/dist/commands/update/pin.js +23 -0
  471. package/dist/commands/update/pin.js.map +1 -0
  472. package/dist/commands/update/reply.d.ts +47 -0
  473. package/dist/commands/update/reply.d.ts.map +1 -0
  474. package/dist/commands/update/reply.js +149 -0
  475. package/dist/commands/update/reply.js.map +1 -0
  476. package/dist/commands/update/toggle.d.ts +70 -0
  477. package/dist/commands/update/toggle.d.ts.map +1 -0
  478. package/dist/commands/update/toggle.js +118 -0
  479. package/dist/commands/update/toggle.js.map +1 -0
  480. package/dist/commands/update/unlike.d.ts +17 -0
  481. package/dist/commands/update/unlike.d.ts.map +1 -0
  482. package/dist/commands/update/unlike.js +22 -0
  483. package/dist/commands/update/unlike.js.map +1 -0
  484. package/dist/commands/update/unpin.d.ts +17 -0
  485. package/dist/commands/update/unpin.d.ts.map +1 -0
  486. package/dist/commands/update/unpin.js +21 -0
  487. package/dist/commands/update/unpin.js.map +1 -0
  488. package/dist/commands/user/get.d.ts +31 -0
  489. package/dist/commands/user/get.d.ts.map +1 -0
  490. package/dist/commands/user/get.js +81 -0
  491. package/dist/commands/user/get.js.map +1 -0
  492. package/dist/commands/user/list.d.ts +61 -0
  493. package/dist/commands/user/list.d.ts.map +1 -0
  494. package/dist/commands/user/list.js +148 -0
  495. package/dist/commands/user/list.js.map +1 -0
  496. package/dist/commands/user/me.d.ts +17 -0
  497. package/dist/commands/user/me.d.ts.map +1 -0
  498. package/dist/commands/user/me.js +49 -0
  499. package/dist/commands/user/me.js.map +1 -0
  500. package/dist/commands/workspace/add-users.d.ts +76 -0
  501. package/dist/commands/workspace/add-users.d.ts.map +1 -0
  502. package/dist/commands/workspace/add-users.js +154 -0
  503. package/dist/commands/workspace/add-users.js.map +1 -0
  504. package/dist/commands/workspace/create.d.ts +59 -0
  505. package/dist/commands/workspace/create.d.ts.map +1 -0
  506. package/dist/commands/workspace/create.js +163 -0
  507. package/dist/commands/workspace/create.js.map +1 -0
  508. package/dist/commands/workspace/delete.d.ts +67 -0
  509. package/dist/commands/workspace/delete.d.ts.map +1 -0
  510. package/dist/commands/workspace/delete.js +182 -0
  511. package/dist/commands/workspace/delete.js.map +1 -0
  512. package/dist/commands/workspace/folders.d.ts +40 -0
  513. package/dist/commands/workspace/folders.d.ts.map +1 -0
  514. package/dist/commands/workspace/folders.js +124 -0
  515. package/dist/commands/workspace/folders.js.map +1 -0
  516. package/dist/commands/workspace/get.d.ts +35 -0
  517. package/dist/commands/workspace/get.d.ts.map +1 -0
  518. package/dist/commands/workspace/get.js +62 -0
  519. package/dist/commands/workspace/get.js.map +1 -0
  520. package/dist/commands/workspace/list.d.ts +57 -0
  521. package/dist/commands/workspace/list.d.ts.map +1 -0
  522. package/dist/commands/workspace/list.js +125 -0
  523. package/dist/commands/workspace/list.js.map +1 -0
  524. package/dist/commands/workspace/remove-users.d.ts +47 -0
  525. package/dist/commands/workspace/remove-users.d.ts.map +1 -0
  526. package/dist/commands/workspace/remove-users.js +122 -0
  527. package/dist/commands/workspace/remove-users.js.map +1 -0
  528. package/dist/commands/workspace/update.d.ts +68 -0
  529. package/dist/commands/workspace/update.d.ts.map +1 -0
  530. package/dist/commands/workspace/update.js +237 -0
  531. package/dist/commands/workspace/update.js.map +1 -0
  532. package/dist/config/load.d.ts +33 -0
  533. package/dist/config/load.d.ts.map +1 -0
  534. package/dist/config/load.js +81 -0
  535. package/dist/config/load.js.map +1 -0
  536. package/dist/index.d.ts +3 -0
  537. package/dist/index.d.ts.map +1 -0
  538. package/dist/index.js +4 -0
  539. package/dist/index.js.map +1 -0
  540. package/dist/types/global-flags.d.ts +69 -0
  541. package/dist/types/global-flags.d.ts.map +1 -0
  542. package/dist/types/global-flags.js +170 -0
  543. package/dist/types/global-flags.js.map +1 -0
  544. package/dist/types/ids.d.ts +38 -0
  545. package/dist/types/ids.d.ts.map +1 -0
  546. package/dist/types/ids.js +51 -0
  547. package/dist/types/ids.js.map +1 -0
  548. package/dist/types/json.d.ts +60 -0
  549. package/dist/types/json.d.ts.map +1 -0
  550. package/dist/types/json.js +33 -0
  551. package/dist/types/json.js.map +1 -0
  552. package/dist/utils/errors.d.ts +121 -0
  553. package/dist/utils/errors.d.ts.map +1 -0
  554. package/dist/utils/errors.js +264 -0
  555. package/dist/utils/errors.js.map +1 -0
  556. package/dist/utils/logger.d.ts +39 -0
  557. package/dist/utils/logger.d.ts.map +1 -0
  558. package/dist/utils/logger.js +49 -0
  559. package/dist/utils/logger.js.map +1 -0
  560. package/dist/utils/output/envelope.d.ts +140 -0
  561. package/dist/utils/output/envelope.d.ts.map +1 -0
  562. package/dist/utils/output/envelope.js +120 -0
  563. package/dist/utils/output/envelope.js.map +1 -0
  564. package/dist/utils/output/json.d.ts +10 -0
  565. package/dist/utils/output/json.d.ts.map +1 -0
  566. package/dist/utils/output/json.js +12 -0
  567. package/dist/utils/output/json.js.map +1 -0
  568. package/dist/utils/output/ndjson.d.ts +92 -0
  569. package/dist/utils/output/ndjson.d.ts.map +1 -0
  570. package/dist/utils/output/ndjson.js +33 -0
  571. package/dist/utils/output/ndjson.js.map +1 -0
  572. package/dist/utils/output/select.d.ts +22 -0
  573. package/dist/utils/output/select.d.ts.map +1 -0
  574. package/dist/utils/output/select.js +47 -0
  575. package/dist/utils/output/select.js.map +1 -0
  576. package/dist/utils/output/table.d.ts +32 -0
  577. package/dist/utils/output/table.d.ts.map +1 -0
  578. package/dist/utils/output/table.js +133 -0
  579. package/dist/utils/output/table.js.map +1 -0
  580. package/dist/utils/output/text.d.ts +5 -0
  581. package/dist/utils/output/text.d.ts.map +1 -0
  582. package/dist/utils/output/text.js +32 -0
  583. package/dist/utils/output/text.js.map +1 -0
  584. package/dist/utils/parse-boundary.d.ts +53 -0
  585. package/dist/utils/parse-boundary.d.ts.map +1 -0
  586. package/dist/utils/parse-boundary.js +62 -0
  587. package/dist/utils/parse-boundary.js.map +1 -0
  588. package/dist/utils/redact.d.ts +54 -0
  589. package/dist/utils/redact.d.ts.map +1 -0
  590. package/dist/utils/redact.js +154 -0
  591. package/dist/utils/redact.js.map +1 -0
  592. package/dist/utils/request-id.d.ts +17 -0
  593. package/dist/utils/request-id.d.ts.map +1 -0
  594. package/dist/utils/request-id.js +26 -0
  595. package/dist/utils/request-id.js.map +1 -0
  596. package/package.json +87 -0
@@ -0,0 +1,418 @@
1
+ import { constants as fsConstants } from 'node:fs';
2
+ import { chmod, mkdir, open, readdir, rename, rm, stat, unlink, writeFile, } from 'node:fs/promises';
3
+ import { homedir } from 'node:os';
4
+ import { dirname, join, relative, resolve, sep } from 'node:path';
5
+ import { randomUUID } from 'node:crypto';
6
+ import { CacheError } from '../utils/errors.js';
7
+ /**
8
+ * Local cache for board metadata, the user directory, and the
9
+ * schema-version pin (`cli-design.md` §8). M3+ reads/writes; M1 ships
10
+ * the primitives so the `cache list/clear/stats` commands can reason
11
+ * over the on-disk state.
12
+ *
13
+ * Invariants:
14
+ * - Files live under `$XDG_CACHE_HOME/monday-cli/` (or
15
+ * `~/.cache/monday-cli/` if XDG isn't set), per §8.
16
+ * - File mode is `0600`. Writes set it explicitly; reads `fstat` and
17
+ * refuse anything group/world-readable.
18
+ * - Writes are atomic via `tmp + rename`. A crash mid-write leaves the
19
+ * previous version in place — never a half-written JSON file.
20
+ * - Per-profile namespacing is deferred to v0.3+. v0.1 is single-
21
+ * profile so the layout stays flat.
22
+ *
23
+ * The CLI never writes secrets here; redaction lives elsewhere. The
24
+ * mode rule is belt-and-braces — if a future regression slipped a
25
+ * sensitive field in, the file's still `0600`.
26
+ */
27
+ const CACHE_DIR_NAME = 'monday-cli';
28
+ const FILE_MODE = 0o600;
29
+ const FILE_MODE_MASK = 0o077;
30
+ const DEFAULT_TTL_SECONDS = 300;
31
+ const CACHE_SCHEMA_VERSION = '1';
32
+ export const CACHE_FILE_MODE = FILE_MODE;
33
+ export const DEFAULT_CACHE_TTL_SECONDS = DEFAULT_TTL_SECONDS;
34
+ /**
35
+ * Resolves the cache root per `cli-design.md` §8 and the XDG Base
36
+ * Directory spec. Order:
37
+ * 1. `$XDG_CACHE_HOME/monday-cli` when set and non-empty.
38
+ * 2. `<home>/.cache/monday-cli` otherwise.
39
+ *
40
+ * The return is always absolute. We don't create the directory here —
41
+ * `writeEntry` does that lazily so a read-only path (`cache list` on a
42
+ * fresh install) doesn't side-effect.
43
+ */
44
+ export const resolveCacheRoot = (options = {}) => {
45
+ const env = options.env ?? process.env;
46
+ const home = options.home ?? homedir();
47
+ const xdg = env.XDG_CACHE_HOME;
48
+ const base = xdg !== undefined && xdg.length > 0 ? xdg : join(home, '.cache');
49
+ return resolve(base, CACHE_DIR_NAME);
50
+ };
51
+ /**
52
+ * Maps a typed cache key to its on-disk relative path. Centralised so
53
+ * every consumer (read/write/clear, plus the M1 commands) agrees on
54
+ * the layout.
55
+ */
56
+ export const cacheKeyToRelativePath = (key) => {
57
+ switch (key.kind) {
58
+ case 'board':
59
+ assertSafeIdentifier(key.boardId, 'board id');
60
+ return join('boards', `${key.boardId}.json`);
61
+ case 'users':
62
+ return join('users', 'index.json');
63
+ case 'schemaVersion':
64
+ return join('schema', 'version.json');
65
+ }
66
+ };
67
+ const SAFE_IDENTIFIER = /^[A-Za-z0-9._-]+$/u;
68
+ const assertSafeIdentifier = (value, label) => {
69
+ if (!SAFE_IDENTIFIER.test(value)) {
70
+ throw new CacheError(`invalid ${label}: ${JSON.stringify(value)}`, {
71
+ details: { hint: 'cache key segments must match [A-Za-z0-9._-]' },
72
+ });
73
+ }
74
+ // The character class accepts `.` and `..` literally — both are
75
+ // path-traversal sentinels on every common filesystem, and a
76
+ // future caller using `.` / `..` as a cache key would happily
77
+ // resolve to a parent directory. Defence in depth (Codex review
78
+ // suggestion): reject the bare-dots forms even though current
79
+ // M1 callers (board ids via `BoardIdSchema`) can't reach this.
80
+ if (value === '.' || value === '..') {
81
+ throw new CacheError(`invalid ${label}: cache key segments may not be "." or "..", got ${JSON.stringify(value)}`, { details: { hint: 'use a non-sentinel identifier' } });
82
+ }
83
+ };
84
+ const wrapFsError = (err, message, details = {}) => {
85
+ const cause = err instanceof Error ? err : new Error(String(err));
86
+ return new CacheError(message, { cause, details });
87
+ };
88
+ const isENOENT = (err) => {
89
+ if (typeof err !== 'object' || err === null) {
90
+ return false;
91
+ }
92
+ return err.code === 'ENOENT';
93
+ };
94
+ const ensureSecureDir = async (path) => {
95
+ // mkdir respects umask, so the explicit `mode` is advisory on some
96
+ // platforms. Re-apply via chmod so a tightened-after-creation
97
+ // directory doesn't betray cache contents to another user.
98
+ try {
99
+ await mkdir(path, { recursive: true, mode: 0o700 });
100
+ await chmod(path, 0o700);
101
+ }
102
+ catch (err) {
103
+ throw wrapFsError(err, `cannot prepare cache directory ${path}`, {
104
+ path,
105
+ });
106
+ }
107
+ };
108
+ /**
109
+ * Reads and parses a cache entry. Returns `undefined` on cache miss
110
+ * (file not present or expired). Throws `CacheError` on any other
111
+ * failure (permission too loose, malformed JSON, decode mismatch).
112
+ */
113
+ export const readEntry = async (root, key, parse, options = {}) => {
114
+ const ttlSeconds = options.ttlSeconds ?? DEFAULT_TTL_SECONDS;
115
+ const now = (options.now ?? (() => new Date()))();
116
+ const relativePath = cacheKeyToRelativePath(key);
117
+ const fullPath = join(root, relativePath);
118
+ let handle;
119
+ try {
120
+ handle = await open(fullPath, fsConstants.O_RDONLY);
121
+ }
122
+ catch (err) {
123
+ if (isENOENT(err)) {
124
+ return undefined;
125
+ }
126
+ throw wrapFsError(err, `cannot read cache entry ${relativePath}`, {
127
+ path: fullPath,
128
+ });
129
+ }
130
+ try {
131
+ const stats = await handle.stat();
132
+ if ((stats.mode & FILE_MODE_MASK) !== 0) {
133
+ throw new CacheError(`refusing to read cache entry with insecure permissions ${formatMode(stats.mode)}`, {
134
+ details: {
135
+ path: fullPath,
136
+ mode: formatMode(stats.mode),
137
+ hint: 'expected mode 0600 — delete and re-fetch',
138
+ },
139
+ });
140
+ }
141
+ const ageSeconds = Math.max(0, Math.floor((now.getTime() - stats.mtimeMs) / 1000));
142
+ if (ageSeconds > ttlSeconds) {
143
+ return undefined;
144
+ }
145
+ const raw = await handle.readFile('utf8');
146
+ let envelope;
147
+ try {
148
+ envelope = JSON.parse(raw);
149
+ }
150
+ catch (err) {
151
+ throw wrapFsError(err, `malformed cache JSON at ${relativePath}`, {
152
+ path: fullPath,
153
+ });
154
+ }
155
+ if (envelope.schema_version !== CACHE_SCHEMA_VERSION) {
156
+ // Treat a different cache schema as a miss — stale on-disk state
157
+ // shouldn't break a fresh CLI version.
158
+ return undefined;
159
+ }
160
+ const parsed = parse(envelope.data);
161
+ return {
162
+ data: parsed,
163
+ ageSeconds,
164
+ path: fullPath,
165
+ sizeBytes: stats.size,
166
+ };
167
+ }
168
+ finally {
169
+ await handle.close();
170
+ }
171
+ };
172
+ /**
173
+ * Writes a cache entry atomically. Sequence:
174
+ * 1. Ensure the parent directory exists with mode `0700`.
175
+ * 2. Write to a tmp sibling with mode `0600`.
176
+ * 3. `rename` over the final path. Atomic on the same filesystem.
177
+ *
178
+ * On any failure the tmp file is best-effort cleaned up so a half-
179
+ * written `.tmp` doesn't accumulate on the next call.
180
+ */
181
+ export const writeEntry = async (root, key, data) => {
182
+ const relativePath = cacheKeyToRelativePath(key);
183
+ const fullPath = join(root, relativePath);
184
+ const dir = dirname(fullPath);
185
+ await ensureSecureDir(root);
186
+ await ensureSecureDir(dir);
187
+ const envelope = {
188
+ schema_version: CACHE_SCHEMA_VERSION,
189
+ created_at: new Date().toISOString(),
190
+ key,
191
+ data,
192
+ };
193
+ const payload = JSON.stringify(envelope);
194
+ const tmpPath = `${fullPath}.${randomUUID()}.tmp`;
195
+ try {
196
+ await writeFile(tmpPath, payload, { mode: FILE_MODE });
197
+ // Some platforms ignore the `mode` on `writeFile` (umask). Re-
198
+ // chmod explicitly so we never leave the file group/world
199
+ // readable.
200
+ await chmod(tmpPath, FILE_MODE);
201
+ await rename(tmpPath, fullPath);
202
+ return { path: fullPath, sizeBytes: Buffer.byteLength(payload, 'utf8') };
203
+ }
204
+ catch (err) {
205
+ await unlink(tmpPath).catch(() => undefined);
206
+ throw wrapFsError(err, `cannot write cache entry ${relativePath}`, {
207
+ path: fullPath,
208
+ });
209
+ }
210
+ };
211
+ const classifyEntry = (relativePath) => {
212
+ const segments = relativePath.split(sep);
213
+ const [first] = segments;
214
+ if (first === 'boards' && segments.length === 2) {
215
+ const [, file] = segments;
216
+ if (file !== undefined) {
217
+ const id = file.replace(/\.json$/u, '');
218
+ return { kind: 'boards', id };
219
+ }
220
+ }
221
+ if (first === 'users') {
222
+ return { kind: 'users', id: undefined };
223
+ }
224
+ if (first === 'schema') {
225
+ return { kind: 'schema', id: undefined };
226
+ }
227
+ return { kind: 'other', id: undefined };
228
+ };
229
+ /**
230
+ * Walks the cache root and reports every JSON entry. Returns an empty
231
+ * array (not an error) when the root doesn't exist — `cache list` on
232
+ * a fresh install is a normal state, not a failure.
233
+ */
234
+ export const listEntries = async (root, options = {}) => {
235
+ const now = (options.now ?? (() => new Date()))();
236
+ let exists = true;
237
+ try {
238
+ await stat(root);
239
+ }
240
+ catch (err) {
241
+ if (isENOENT(err)) {
242
+ exists = false;
243
+ }
244
+ else {
245
+ throw wrapFsError(err, `cannot stat cache root ${root}`, { path: root });
246
+ }
247
+ }
248
+ if (!exists) {
249
+ return [];
250
+ }
251
+ const found = [];
252
+ await walk(root, root, found, now);
253
+ // Stable order: sorted by relative path. Spec says agents key off
254
+ // shape; deterministic output is friendlier than insertion order.
255
+ return [...found].sort((a, b) => a.relativePath.localeCompare(b.relativePath));
256
+ };
257
+ const walk = async (root, current, out, now) => {
258
+ let entries;
259
+ try {
260
+ entries = await readdir(current, { withFileTypes: true });
261
+ }
262
+ catch (err) {
263
+ throw wrapFsError(err, `cannot read cache directory ${current}`, {
264
+ path: current,
265
+ });
266
+ }
267
+ for (const entry of entries) {
268
+ const full = join(current, entry.name);
269
+ if (entry.isDirectory()) {
270
+ await walk(root, full, out, now);
271
+ continue;
272
+ }
273
+ if (!entry.isFile() || !entry.name.endsWith('.json')) {
274
+ // Skip non-file dirents (sockets/symlinks) and non-cache files
275
+ // (a stray README.txt under boards/, etc.). Either case is an
276
+ // un-cataloged on-disk artefact, not something `cache list`
277
+ // should fabricate an entry for.
278
+ continue;
279
+ }
280
+ let stats;
281
+ try {
282
+ stats = await stat(full);
283
+ }
284
+ catch (err) {
285
+ throw wrapFsError(err, `cannot stat cache file ${full}`, { path: full });
286
+ }
287
+ const relativePath = relative(root, full);
288
+ const { kind, id } = classifyEntry(relativePath);
289
+ const ageSeconds = Math.max(0, Math.floor((now.getTime() - stats.mtimeMs) / 1000));
290
+ out.push({
291
+ path: full,
292
+ relativePath,
293
+ sizeBytes: stats.size,
294
+ modifiedAt: new Date(stats.mtimeMs).toISOString(),
295
+ ageSeconds,
296
+ kind,
297
+ id,
298
+ });
299
+ }
300
+ };
301
+ /**
302
+ * Removes a single entry. Missing → no-op; reports zero removals so
303
+ * `cache clear --board <bid>` against an unknown board doesn't fail.
304
+ */
305
+ export const clearEntry = async (root, key) => {
306
+ const fullPath = join(root, cacheKeyToRelativePath(key));
307
+ let stats;
308
+ try {
309
+ stats = await stat(fullPath);
310
+ }
311
+ catch (err) {
312
+ if (isENOENT(err)) {
313
+ return { removed: 0, bytesFreed: 0 };
314
+ }
315
+ throw wrapFsError(err, `cannot stat cache entry ${fullPath}`, {
316
+ path: fullPath,
317
+ });
318
+ }
319
+ try {
320
+ await unlink(fullPath);
321
+ }
322
+ catch (err) {
323
+ throw wrapFsError(err, `cannot remove cache entry ${fullPath}`, {
324
+ path: fullPath,
325
+ });
326
+ }
327
+ return { removed: 1, bytesFreed: stats.size };
328
+ };
329
+ /**
330
+ * Eager invalidation of a board's metadata cache entry per
331
+ * `cli-design.md` §8 eager-invalidation contract (M16). Thin wrapper
332
+ * over `clearEntry(root, { kind: 'board', boardId })` that owns the
333
+ * cache-root resolution so call sites — every M16 column-mutation
334
+ * verb plus the M15 retrofit cluster (`board update` / `archive` /
335
+ * `delete`) — read as `invalidateBoard(boardId)` rather than
336
+ * `clearEntry(resolveCacheRoot({env}), {kind:'board',boardId})`.
337
+ *
338
+ * **Idempotent.** Invalidating an already-absent entry is a no-op
339
+ * (matches `clearEntry`'s missing-file semantics) — callers don't
340
+ * need to gate the call on "is this board cached?". Errors during
341
+ * unlink (permission flip, disk loss) bubble as `CacheError` per the
342
+ * underlying primitive.
343
+ *
344
+ * **Process-local.** The on-disk cache file IS shared across
345
+ * processes (same `$XDG_CACHE_HOME/monday-cli/boards/<bid>.json`
346
+ * path), so this `unlink` does remove peer processes' cache entries;
347
+ * the missing primitive is inter-process locking. Cross-process
348
+ * coordination is explicitly deferred to v0.3 per cli-design §8 —
349
+ * this helper does NOT add inter-process locking.
350
+ *
351
+ * Mirrors `evictBoardMetadata` in `board-metadata.ts` (the M3-era
352
+ * helper that predates the eager-invalidation contract); the two
353
+ * helpers are intentionally parallel — `evictBoardMetadata` lives
354
+ * next to the metadata loader and is consumed by tests + potential
355
+ * future `cache clear --board <bid>` flows; `invalidateBoard` lives
356
+ * here next to the underlying `clearEntry` primitive and is consumed
357
+ * by every M16+ board-structure mutation per the §8 contract. Lifting
358
+ * one over the other was rejected during M16 pre-flight to keep the
359
+ * existing test surface unchanged.
360
+ */
361
+ export const invalidateBoard = async (boardId,
362
+ /* c8 ignore next — defensive default; callers pass an explicit env. */
363
+ env = process.env) => {
364
+ const root = resolveCacheRoot({ env });
365
+ return clearEntry(root, { kind: 'board', boardId });
366
+ };
367
+ /**
368
+ * Removes the entire cache root. Used by `monday cache clear` (no
369
+ * flag) and tests. Counts removed JSON files for reporting; the
370
+ * directory tree itself goes too so a follow-up `cache list` reports
371
+ * an empty cache, not phantom directories.
372
+ */
373
+ export const clearAll = async (root) => {
374
+ const entries = await listEntries(root);
375
+ if (entries.length === 0) {
376
+ // Nothing to remove; only delete the dir tree if it exists so the
377
+ // `cache list` output stays empty afterwards.
378
+ await rm(root, { recursive: true, force: true });
379
+ return { removed: 0, bytesFreed: 0 };
380
+ }
381
+ const bytesFreed = entries.reduce((sum, e) => sum + e.sizeBytes, 0);
382
+ try {
383
+ await rm(root, { recursive: true, force: true });
384
+ }
385
+ catch (err) {
386
+ throw wrapFsError(err, `cannot clear cache root ${root}`, { path: root });
387
+ }
388
+ return { removed: entries.length, bytesFreed };
389
+ };
390
+ export const stats = async (root, options = {}) => {
391
+ const entries = await listEntries(root, options);
392
+ if (entries.length === 0) {
393
+ // listEntries already threw on EACCES / etc.; reaching here means
394
+ // the root was either missing or present-and-empty. A quick stat
395
+ // distinguishes — any failure (race with `rm`, etc.) is treated
396
+ // as "doesn't exist" rather than re-wrapping into a CacheError.
397
+ const exists = await stat(root).then(() => true, () => false);
398
+ return {
399
+ root,
400
+ exists,
401
+ entries: 0,
402
+ bytes: 0,
403
+ oldestAgeSeconds: null,
404
+ newestAgeSeconds: null,
405
+ };
406
+ }
407
+ const ages = entries.map((e) => e.ageSeconds);
408
+ return {
409
+ root,
410
+ exists: true,
411
+ entries: entries.length,
412
+ bytes: entries.reduce((sum, e) => sum + e.sizeBytes, 0),
413
+ oldestAgeSeconds: Math.max(...ages),
414
+ newestAgeSeconds: Math.min(...ages),
415
+ };
416
+ };
417
+ const formatMode = (mode) => `0${(mode & 0o777).toString(8).padStart(3, '0')}`;
418
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/api/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,WAAW,EAAc,MAAM,SAAS,CAAC;AAC/D,OAAO,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,OAAO,EACP,MAAM,EACN,EAAE,EACF,IAAI,EACJ,MAAM,EACN,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,cAAc,GAAG,YAAY,CAAC;AACpC,MAAM,SAAS,GAAG,KAAK,CAAC;AACxB,MAAM,cAAc,GAAG,KAAK,CAAC;AAC7B,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAEjC,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC;AACzC,MAAM,CAAC,MAAM,yBAAyB,GAAG,mBAAmB,CAAC;AAY7D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,UAA4B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AO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAC9C,OAAO;QACL,IAAI;QACJ,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,OAAO,CAAC,MAAM;QACvB,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;QACvD,gBAAgB,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;QACnC,gBAAgB,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;KACpC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,IAAY,EAAU,EAAE,CAC1C,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC"}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Monday GraphQL client over the injected `Transport`
3
+ * (`v0.1-plan.md` §3 M2).
4
+ *
5
+ * Why not the SDK's `ApiClient`. The plan's wording is
6
+ * "wraps `@mondaydotcomorg/api`'s `ApiClient`" but the SDK's
7
+ * `request()` doesn't accept an external `AbortSignal` — it builds
8
+ * its own controller per-call, which means the runner's SIGINT-ware
9
+ * abort can't cancel an in-flight request. Tests also need to swap
10
+ * the network stack without monkey-patching SDK internals (Codex
11
+ * review §2 of M0). Both problems are solved by the existing
12
+ * `Transport` interface, so the client routes every call through
13
+ * `transport.request()` and uses the SDK only for *types* — `Account`,
14
+ * `User`, `Complexity`, `Version`, `CURRENT_VERSION`.
15
+ *
16
+ * Header injection (`Authorization`, `API-Version`, `Content-Type`)
17
+ * lives in `FetchTransport` and is locked down (Codex review M0 §1
18
+ * follow-up). Caller-supplied headers can't override it; this client
19
+ * passes only operation-name and any future trace headers.
20
+ *
21
+ * Internal callers see `Record<string, unknown>` for variables. The
22
+ * SDK's `QueryVariables = Record<string, any>` boundary leak is
23
+ * contained at this module's edge — no `any` flows into `commands/*`.
24
+ */
25
+ import { type RetryStats } from './retry.js';
26
+ import type { Transport } from './transport.js';
27
+ import type { Complexity } from '../utils/output/envelope.js';
28
+ /**
29
+ * The Monday API version pinned to the SDK install. Re-exported so
30
+ * the production runner and `monday account version` read the same
31
+ * source of truth — bumping the SDK is the only way this changes.
32
+ */
33
+ export declare const PINNED_API_VERSION: string;
34
+ export interface MondayClientConfig {
35
+ readonly transport: Transport;
36
+ readonly signal: AbortSignal;
37
+ /**
38
+ * Maximum retries per request. Comes from `--retry` (default 3).
39
+ * Passed through to `withRetry`; the retry layer respects
40
+ * `error.retryable` + `retry_after_seconds`.
41
+ */
42
+ readonly retries: number;
43
+ /**
44
+ * When true, every request injects the `complexity { ... }`
45
+ * selection at the outermost selection set and parses the result
46
+ * onto `Complexity`. Comes from `--verbose`.
47
+ */
48
+ readonly verbose: boolean;
49
+ /**
50
+ * Test hooks — production wires these to defaults. Documented in
51
+ * `api/retry.ts` (`RetryOptions`).
52
+ */
53
+ readonly retrySleep?: (ms: number, signal: AbortSignal) => Promise<void>;
54
+ readonly retryRandom?: () => number;
55
+ }
56
+ export interface MondayRequestOptions {
57
+ /**
58
+ * Marker passed to the transport for a friendlier `body.operationName`
59
+ * — Monday's logs surface this when triaging issues. Defaults to
60
+ * the typed-method's name (e.g. `"whoami"`).
61
+ */
62
+ readonly operationName?: string;
63
+ }
64
+ export interface MondayResponse<T> {
65
+ readonly data: T;
66
+ /**
67
+ * Always present — null when the response carried no `complexity`
68
+ * block, an object otherwise. Matches `cli-design.md` §6.1's rule
69
+ * for `meta.complexity`.
70
+ */
71
+ readonly complexity: Complexity | null;
72
+ /** How many transport calls happened (1 = first attempt succeeded). */
73
+ readonly stats: RetryStats;
74
+ }
75
+ /**
76
+ * Subset of Monday's `User` we surface on `monday account whoami` /
77
+ * `monday user me`. The SDK's full `User` type (~30 fields) is too
78
+ * wide — we project to the slim shape `cli-design.md` calls out.
79
+ */
80
+ export interface WhoamiData {
81
+ /**
82
+ * `me` is nullable in the wire shape — Monday returns `null` when
83
+ * the token is valid syntactically but belongs to a guest /
84
+ * disabled user. Commands surface that case as `unauthorized`.
85
+ */
86
+ readonly me: {
87
+ readonly id: string;
88
+ readonly name: string;
89
+ readonly email: string;
90
+ readonly account: {
91
+ readonly id: string;
92
+ readonly name: string;
93
+ readonly slug: string | null;
94
+ };
95
+ } | null;
96
+ }
97
+ export interface AccountData {
98
+ /**
99
+ * Same nullability story as `me` above — Monday won't typically
100
+ * return a null account for a valid token, but the wire field is
101
+ * `Maybe<Account>` and the CLI treats null as `not_found`.
102
+ */
103
+ readonly account: {
104
+ readonly id: string;
105
+ readonly name: string;
106
+ readonly slug: string | null;
107
+ readonly country_code: string | null;
108
+ readonly first_day_of_the_week: string | null;
109
+ readonly active_members_count: number | null;
110
+ readonly logo: string | null;
111
+ readonly plan: {
112
+ readonly version: number;
113
+ readonly tier: string;
114
+ readonly max_users: number;
115
+ readonly period: string | null;
116
+ } | null;
117
+ } | null;
118
+ }
119
+ export interface VersionsData {
120
+ readonly versions: readonly {
121
+ readonly display_name: string;
122
+ readonly kind: string;
123
+ readonly value: string;
124
+ }[];
125
+ }
126
+ export interface ComplexityProbeData {
127
+ readonly complexity: {
128
+ readonly before: number;
129
+ readonly after: number;
130
+ readonly query: number;
131
+ readonly reset_in_x_seconds: number;
132
+ } | null;
133
+ }
134
+ export declare class MondayClient {
135
+ private readonly transport;
136
+ private readonly signal;
137
+ private readonly retries;
138
+ private readonly verbose;
139
+ private readonly retrySleep;
140
+ private readonly retryRandom;
141
+ constructor(config: MondayClientConfig);
142
+ /**
143
+ * Low-level escape hatch (`v0.1-plan.md` §3 M2 deliverable).
144
+ * `commands/raw` (M6) calls this directly; M2 commands use the
145
+ * typed wrappers. Returns the parsed `data` plus the per-request
146
+ * complexity meta and retry stats.
147
+ *
148
+ * Variables are typed `Record<string, unknown>` rather than the
149
+ * SDK's `any`-laced `QueryVariables` so the surface stays sealed.
150
+ */
151
+ readonly raw: <T>(query: string, variables: Readonly<Record<string, unknown>> | undefined, options?: MondayRequestOptions) => Promise<MondayResponse<T>>;
152
+ readonly whoami: () => Promise<MondayResponse<WhoamiData>>;
153
+ readonly account: () => Promise<MondayResponse<AccountData>>;
154
+ readonly versions: () => Promise<MondayResponse<VersionsData>>;
155
+ /**
156
+ * Cheapest possible call: just selects the `complexity` field with
157
+ * no payload. Used by `monday account complexity` to probe the
158
+ * budget without any other side-effect.
159
+ */
160
+ readonly complexityProbe: () => Promise<MondayResponse<ComplexityProbeData>>;
161
+ }
162
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAA0C,CAAC;AAE5E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,MAAM,CAAC;C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