monday-cli 0.3.0 → 0.4.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 (107) hide show
  1. package/CHANGELOG.md +351 -0
  2. package/README.md +130 -36
  3. package/dist/api/assets.d.ts +326 -0
  4. package/dist/api/assets.d.ts.map +1 -0
  5. package/dist/api/assets.js +519 -0
  6. package/dist/api/assets.js.map +1 -0
  7. package/dist/api/column-types.d.ts +11 -7
  8. package/dist/api/column-types.d.ts.map +1 -1
  9. package/dist/api/column-types.js +5 -3
  10. package/dist/api/column-types.js.map +1 -1
  11. package/dist/api/column-values.d.ts +7 -1
  12. package/dist/api/column-values.d.ts.map +1 -1
  13. package/dist/api/column-values.js +15 -6
  14. package/dist/api/column-values.js.map +1 -1
  15. package/dist/api/documents.d.ts +519 -0
  16. package/dist/api/documents.d.ts.map +1 -0
  17. package/dist/api/documents.js +586 -0
  18. package/dist/api/documents.js.map +1 -0
  19. package/dist/api/item-watch.d.ts +263 -0
  20. package/dist/api/item-watch.d.ts.map +1 -0
  21. package/dist/api/item-watch.js +709 -0
  22. package/dist/api/item-watch.js.map +1 -0
  23. package/dist/api/multipart-transport.d.ts +223 -0
  24. package/dist/api/multipart-transport.d.ts.map +1 -0
  25. package/dist/api/multipart-transport.js +274 -0
  26. package/dist/api/multipart-transport.js.map +1 -0
  27. package/dist/api/parallel-dispatch.d.ts +155 -0
  28. package/dist/api/parallel-dispatch.d.ts.map +1 -0
  29. package/dist/api/parallel-dispatch.js +243 -0
  30. package/dist/api/parallel-dispatch.js.map +1 -0
  31. package/dist/api/partial-success-bulk.d.ts +118 -60
  32. package/dist/api/partial-success-bulk.d.ts.map +1 -1
  33. package/dist/api/partial-success-bulk.js +137 -79
  34. package/dist/api/partial-success-bulk.js.map +1 -1
  35. package/dist/api/partial-success-mutation.d.ts +13 -1
  36. package/dist/api/partial-success-mutation.d.ts.map +1 -1
  37. package/dist/api/partial-success-mutation.js +5 -1
  38. package/dist/api/partial-success-mutation.js.map +1 -1
  39. package/dist/api/raw-write.d.ts +12 -4
  40. package/dist/api/raw-write.d.ts.map +1 -1
  41. package/dist/api/raw-write.js +21 -11
  42. package/dist/api/raw-write.js.map +1 -1
  43. package/dist/api/resolve-client.d.ts +11 -0
  44. package/dist/api/resolve-client.d.ts.map +1 -1
  45. package/dist/api/resolve-client.js +9 -1
  46. package/dist/api/resolve-client.js.map +1 -1
  47. package/dist/cli/run.d.ts +20 -0
  48. package/dist/cli/run.d.ts.map +1 -1
  49. package/dist/cli/run.js +1 -0
  50. package/dist/cli/run.js.map +1 -1
  51. package/dist/commands/board/column-create.d.ts +6 -5
  52. package/dist/commands/board/column-create.d.ts.map +1 -1
  53. package/dist/commands/board/column-create.js +9 -6
  54. package/dist/commands/board/column-create.js.map +1 -1
  55. package/dist/commands/completion.d.ts +188 -0
  56. package/dist/commands/completion.d.ts.map +1 -0
  57. package/dist/commands/completion.js +418 -0
  58. package/dist/commands/completion.js.map +1 -0
  59. package/dist/commands/doc/get.d.ts +46 -0
  60. package/dist/commands/doc/get.d.ts.map +1 -0
  61. package/dist/commands/doc/get.js +95 -0
  62. package/dist/commands/doc/get.js.map +1 -0
  63. package/dist/commands/doc/list.d.ts +83 -0
  64. package/dist/commands/doc/list.d.ts.map +1 -0
  65. package/dist/commands/doc/list.js +248 -0
  66. package/dist/commands/doc/list.js.map +1 -0
  67. package/dist/commands/index.d.ts.map +1 -1
  68. package/dist/commands/index.js +46 -0
  69. package/dist/commands/index.js.map +1 -1
  70. package/dist/commands/item/create.js +2 -2
  71. package/dist/commands/item/update.d.ts +1 -0
  72. package/dist/commands/item/update.d.ts.map +1 -1
  73. package/dist/commands/item/update.js +61 -0
  74. package/dist/commands/item/update.js.map +1 -1
  75. package/dist/commands/item/upload.d.ts +108 -0
  76. package/dist/commands/item/upload.d.ts.map +1 -0
  77. package/dist/commands/item/upload.js +370 -0
  78. package/dist/commands/item/upload.js.map +1 -0
  79. package/dist/commands/item/watch.d.ts +90 -0
  80. package/dist/commands/item/watch.d.ts.map +1 -0
  81. package/dist/commands/item/watch.js +342 -0
  82. package/dist/commands/item/watch.js.map +1 -0
  83. package/dist/commands/update/upload.d.ts +69 -0
  84. package/dist/commands/update/upload.d.ts.map +1 -0
  85. package/dist/commands/update/upload.js +235 -0
  86. package/dist/commands/update/upload.js.map +1 -0
  87. package/dist/types/ids.d.ts +2 -0
  88. package/dist/types/ids.d.ts.map +1 -1
  89. package/dist/types/ids.js +9 -2
  90. package/dist/types/ids.js.map +1 -1
  91. package/dist/utils/mime.d.ts +24 -0
  92. package/dist/utils/mime.d.ts.map +1 -0
  93. package/dist/utils/mime.js +64 -0
  94. package/dist/utils/mime.js.map +1 -0
  95. package/dist/utils/output/envelope.d.ts +30 -0
  96. package/dist/utils/output/envelope.d.ts.map +1 -1
  97. package/dist/utils/output/envelope.js +26 -0
  98. package/dist/utils/output/envelope.js.map +1 -1
  99. package/dist/utils/output/ndjson.d.ts +25 -0
  100. package/dist/utils/output/ndjson.d.ts.map +1 -1
  101. package/dist/utils/output/ndjson.js +12 -0
  102. package/dist/utils/output/ndjson.js.map +1 -1
  103. package/dist/utils/signal.d.ts +42 -0
  104. package/dist/utils/signal.d.ts.map +1 -0
  105. package/dist/utils/signal.js +45 -0
  106. package/dist/utils/signal.js.map +1 -0
  107. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../src/api/documents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2GG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAwB9D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AU,EAAE,UAAU,GAAG,IAAI,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,mBAAmB,KAC1B,OAAO,CAAC,mBAAmB,CA+C7B,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,eAAe,EAAE,IAAI,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,WAAW,GACtB,QAAQ,iBAAiB,KACxB,OAAO,CAAC,iBAAiB,CA8D3B,CAAC"}
@@ -0,0 +1,586 @@
1
+ /**
2
+ * Workdocs read surface for the v0.4-M32 `monday doc list/get` verbs
3
+ * (`cli-design.md` §2.7 + §4.3 + §13 v0.4 entry; `v0.4-plan.md` §3
4
+ * M32).
5
+ *
6
+ * **Wire surface (empirical probe 2026-05-14, API `2026-01`).** Two
7
+ * Monday GraphQL operations land here, both against `Query.docs(...)`:
8
+ *
9
+ * - **List variant** — `Query.docs(workspace_ids: [ID],
10
+ * order_by: DocsOrderBy, limit: Int, page: Int) → [Document]`.
11
+ * Page/limit pagination (NOT cursor — Monday's workdocs surface
12
+ * has no `items_page`-style cursor). Default `limit: 25` on the
13
+ * wire side; CLI caps `--limit` at `MAX_DOC_LIST_LIMIT = 100`
14
+ * to keep response sizes bounded (each Document is rich-text
15
+ * plus metadata, and a `--limit 500` request could blow past
16
+ * Monday's complexity budget on doc-heavy accounts). `--page`
17
+ * is 1-based.
18
+ * - **Get variant** — `Query.docs(ids: [ID!]) → [Document]` with
19
+ * the per-doc `blocks` selection hydrated. Returns at most one
20
+ * Document (single-id list). The CLI extracts the singleton
21
+ * index 0; an empty array surfaces `not_found` (D8 — Monday's
22
+ * wire collapses doesn't-exist + not-accessible into the same
23
+ * shape), while a null `docs` root surfaces `internal_error`
24
+ * with a drift hint (Monday's documented shape is `[Document]`,
25
+ * possibly empty, never null — null indicates wire-shape
26
+ * regression worth surfacing loudly). The
27
+ * `Document.blocks: [DocumentBlock]` selection adds significant
28
+ * payload, which is why `doc list` ships WITHOUT `blocks` and
29
+ * `doc get` is the per-doc body-hydrating path.
30
+ *
31
+ * **`Document` object — 14 fields.** Per the M32 empirical probe:
32
+ * `id` (ID!), `object_id` (ID!), `blocks` ([DocumentBlock]; null
33
+ * unless hydrated), `created_at` (Date, nullable), `created_by`
34
+ * (User, nullable — projected to the slim `{id, name}` shape for
35
+ * envelope compactness), `doc_folder_id` (ID, nullable),
36
+ * `doc_kind` (BoardKind!, returning `'public'`/`'private'`/
37
+ * `'share'` per the DocKind probe at API `2026-01` — non-null on
38
+ * the wire; the standalone `DocKind` enum exists but isn't
39
+ * returned by `Document.doc_kind`), `name` (String!),
40
+ * `relative_url` (String, nullable),
41
+ * `settings` (JSON, nullable), `updated_at` (Date, nullable),
42
+ * `url` (String, nullable absolute URL), `workspace` (Workspace,
43
+ * nullable — projected to `{id, name}`), `workspace_id` (ID,
44
+ * nullable). The `object_id` is Monday's internal opaque object
45
+ * identifier (distinct from `id`); both flow through verbatim.
46
+ *
47
+ * **BoardKind reuse for `Document.doc_kind`.** Monday's wire schema
48
+ * types `Document.doc_kind` as `BoardKind!` (NOT `DocKind!`) — the
49
+ * `BoardKind` enum is reused across `Board.kind` and
50
+ * `Document.doc_kind`, returning the same three string values
51
+ * (`public`/`private`/`share`). The standalone `DocKind` enum exists
52
+ * on the schema but isn't returned by `Document.doc_kind`; it's a
53
+ * wire-side detail with no agent-visible asymmetry (the CLI surface
54
+ * mirrors the wire string values verbatim). Not a new R-NEW-41
55
+ * consumer — the wire-vs-CLI projection is symmetric.
56
+ *
57
+ * **`DocumentBlock` — 9 fields.** Per the M32 probe: `id` (String!),
58
+ * `type` (String, nullable — block type like `'text'` / `'heading'`
59
+ * / `'list'` / etc., values stay verbatim from Monday's wire),
60
+ * `content` (JSON, nullable — block payload), `position` (Float,
61
+ * nullable — fractional ordering within doc), `parent_block_id`
62
+ * (String, nullable — for nested blocks), `doc_id` (ID, nullable),
63
+ * `created_at` (Date, nullable), `created_by` (User, nullable —
64
+ * projected to slim `{id, name}`), `updated_at` (Date, nullable).
65
+ * Block-content schema validity is NOT cross-checked by the CLI;
66
+ * Monday's wire is the source of truth for what blocks look like.
67
+ *
68
+ * **`DocsOrderBy` enum — 2 values.** `created_at` (most-recently-
69
+ * created first; Monday's documented `desc` ordering) and `used_at`
70
+ * (most-recently-viewed-by-current-user first; also `desc`). No
71
+ * ascending variant on Monday's wire — agents that need ascending
72
+ * sort the projection client-side. Default CLI behaviour: `created_
73
+ * at` (matches Monday's wire default at API `2026-01`).
74
+ *
75
+ * **No new ERROR_CODES (29 stays — D8 closure).** Doc-read failures
76
+ * route through existing codes:
77
+ *
78
+ * - `not_found` — `doc get <did>` against a non-existent or
79
+ * inaccessible doc ID. Monday's wire returns an empty `docs`
80
+ * array for both "doesn't exist" and "exists but token can't
81
+ * read it"; the CLI surfaces both as `not_found` with
82
+ * `details.doc_id`.
83
+ * - `usage_error` — argv-parse rejections (out-of-range `--limit`
84
+ * / `--page`, malformed `--workspace`, unknown `--order-by`).
85
+ * Caught at parse boundary BEFORE any wire call.
86
+ * - `validation_failed` — Monday-side rejection (very rare for
87
+ * reads; included for completeness).
88
+ * - `forbidden` / `unauthorized` — token lacks workdoc read scope.
89
+ *
90
+ * **Docs are live-only at v0.4-M32.** Per cli-design §8 cache scope,
91
+ * workdocs aren't cached — the `doc list` + `doc get` paths emit
92
+ * `meta.source: "live"` with `cache_age_seconds: null`. Workdocs
93
+ * are content-heavy + frequently human-edited, so caching would
94
+ * regularly surface stale prose. Mirrors `monday usage` (M22) +
95
+ * `monday status` (M22) + webhook list (M27) — diagnostics /
96
+ * volatile surfaces don't cache.
97
+ *
98
+ * **Runtime bodies landed at v0.4-M32 IMPL.** `listDocuments` +
99
+ * `getDocument` each issue a single `client.raw` round-trip with
100
+ * `operationName: 'ListDocs'` / `'GetDoc'` pinned literally at the
101
+ * fetcher boundary (R-NEW-37 W2 audit-point — operationNames are
102
+ * NOT caller-overridable). Responses parse through
103
+ * {@link documentSchema} / {@link documentWithBlocksSchema} via
104
+ * `unwrapOrThrow`, so payload drift surfaces `internal_error` with
105
+ * `details.issues`. The `doc get` empty-array case rewraps to
106
+ * `not_found` with `details.doc_id` per D8 (Monday's wire collapses
107
+ * "doesn't exist" + "not visible to token" into the same shape).
108
+ */
109
+ import { z } from 'zod';
110
+ import { ApiError } from '../utils/errors.js';
111
+ import { unwrapOrThrow } from '../utils/parse-boundary.js';
112
+ /**
113
+ * Schema for a required JSON-scalar slot — the key must be present
114
+ * on the parsed object, but the value can be any JSON shape Monday
115
+ * surfaces (object / array / string / number / boolean / null).
116
+ *
117
+ * Bare `z.unknown()` treats a missing key as "present with value
118
+ * `undefined`", so a wire response that omits `Document.settings`
119
+ * or `DocumentBlock.content` would still pass the strict schema —
120
+ * silently weakening the 13-field / 9-field contract. The
121
+ * `.refine` rejects `undefined` explicitly so a missing key
122
+ * surfaces as a typed parse error at the IMPL response-parse
123
+ * boundary (will fold into `internal_error` via `unwrapOrThrow`),
124
+ * matching every other field's "present-but-typed" semantics.
125
+ *
126
+ * Mirrors the M27 `Webhook.config: z.string().nullable()` pin
127
+ * (config is always present, value can be null) but for JSON-
128
+ * shaped slots whose payload shape varies per surface.
129
+ */
130
+ const requiredJsonValueSchema = z.unknown().refine((v) => v !== undefined, {
131
+ message: 'required JSON value (may be null, but the key must be present)',
132
+ });
133
+ /**
134
+ * Inclusive range for the `--limit` argv slot on `monday doc list`.
135
+ * Default `25` matches Monday's wire-side default at API `2026-01`
136
+ * (per the M32 empirical probe `Query.docs.args.limit.description`:
137
+ * "Number of items to get, the default is 25"); ceiling `100` keeps
138
+ * worst-case response sizes bounded for doc-heavy accounts (a
139
+ * `--limit 500` request would multiply payload across 500 rich-text
140
+ * Document records, easily blowing Monday's complexity budget).
141
+ */
142
+ export const MIN_DOC_LIST_LIMIT = 1;
143
+ export const MAX_DOC_LIST_LIMIT = 100;
144
+ export const DEFAULT_DOC_LIST_LIMIT = 25;
145
+ /**
146
+ * Monday's `DocsOrderBy` enum vocabulary (empirical probe 2026-05-14,
147
+ * API `2026-01`; 2 values). Pinned at M32 pre-flight as a closed
148
+ * literal-union enum so unknown `--order-by` values reject at parse
149
+ * boundary with `usage_error`.
150
+ *
151
+ * Both values sort `desc` on Monday's wire (most-recent first); no
152
+ * ascending variant is exposed. Adding a third value to Monday's
153
+ * enum is a minor (additive) bump for the CLI — extend this list +
154
+ * the per-command flag help.
155
+ */
156
+ export const DOCS_ORDER_BY = ['created_at', 'used_at'];
157
+ export const docsOrderBySchema = z.enum(DOCS_ORDER_BY);
158
+ export const DEFAULT_DOCS_ORDER_BY = 'created_at';
159
+ /**
160
+ * Slim projection of Monday's `User` for the `Document.created_by` +
161
+ * `DocumentBlock.created_by` slots. Mirrors the M19 `account_tags`
162
+ * + M31 `Asset.uploaded_by` slim-User cadence: `{id, name}` only,
163
+ * keeping envelope size bounded. Full-User reads route through
164
+ * `monday user get <uid>`.
165
+ */
166
+ export const docUserSchema = z
167
+ .object({
168
+ id: z.string().min(1),
169
+ name: z.string().min(1),
170
+ })
171
+ .strict();
172
+ /**
173
+ * Slim projection of Monday's `Workspace` for the `Document.workspace`
174
+ * slot. Same `{id, name}` shape as {@link docUserSchema}. Full-
175
+ * Workspace reads route through `monday workspace get <wid>`.
176
+ */
177
+ export const docWorkspaceSchema = z
178
+ .object({
179
+ id: z.string().min(1),
180
+ name: z.string().min(1),
181
+ })
182
+ .strict();
183
+ /**
184
+ * `doc_kind` literal-union enum (3 values per the M32 probe + the
185
+ * DocKind introspection result). Monday's wire types this field as
186
+ * `BoardKind!` — see the module header's "BoardKind reuse" note for
187
+ * the wire-side type-name aliasing. The CLI surface mirrors the
188
+ * three string values verbatim with no projection drift.
189
+ */
190
+ export const DOC_KIND_VALUES = ['public', 'private', 'share'];
191
+ export const docKindSchema = z.enum(DOC_KIND_VALUES);
192
+ /**
193
+ * DocumentBlock projection — Monday's 9-field block shape per the
194
+ * M32 probe. `content` is `JSON` on the wire (block payload — schema
195
+ * varies per `type`); the CLI passes it through unmodified as
196
+ * `unknown` so agents introspect the per-block-type payload
197
+ * themselves (Monday's wire is the source of truth for the per-
198
+ * block-type schema).
199
+ *
200
+ * Only surfaces under `doc get` envelopes (the per-doc body-hydrating
201
+ * path); `doc list` envelopes ship Documents WITHOUT `blocks` per
202
+ * the D6 list-row-projection closure.
203
+ */
204
+ export const documentBlockSchema = z
205
+ .object({
206
+ id: z.string().min(1),
207
+ type: z.string().nullable(),
208
+ content: requiredJsonValueSchema,
209
+ position: z.number().nullable(),
210
+ parent_block_id: z.string().nullable(),
211
+ doc_id: z.string().nullable(),
212
+ created_at: z.string().nullable(),
213
+ created_by: docUserSchema.nullable(),
214
+ updated_at: z.string().nullable(),
215
+ })
216
+ .strict();
217
+ /**
218
+ * Base Document projection (13 fields — all of Monday's 14 minus
219
+ * `blocks`). Used as the list-row shape under `doc list` envelopes;
220
+ * appended with the required `blocks: [DocumentBlock]` slot for
221
+ * `doc get` envelopes via {@link documentWithBlocksSchema} (the
222
+ * extension makes `blocks` mandatory — `doc get` always hydrates
223
+ * the rich-text body per D6).
224
+ *
225
+ * `settings` is `JSON` on the wire (per-doc display/sharing config)
226
+ * — passed through as `unknown` for the same reason
227
+ * `DocumentBlock.content` is. Agents that need a specific settings
228
+ * key destructure client-side.
229
+ */
230
+ export const documentSchema = z
231
+ .object({
232
+ id: z.string().min(1),
233
+ object_id: z.string().min(1),
234
+ name: z.string().min(1),
235
+ doc_kind: docKindSchema,
236
+ url: z.string().nullable(),
237
+ relative_url: z.string().nullable(),
238
+ workspace_id: z.string().nullable(),
239
+ workspace: docWorkspaceSchema.nullable(),
240
+ doc_folder_id: z.string().nullable(),
241
+ created_at: z.string().nullable(),
242
+ created_by: docUserSchema.nullable(),
243
+ updated_at: z.string().nullable(),
244
+ settings: requiredJsonValueSchema,
245
+ })
246
+ .strict();
247
+ /**
248
+ * `doc get` projection — base Document + the `blocks` slot hydrated.
249
+ * Same shape as {@link documentSchema} with `blocks:
250
+ * [DocumentBlock]` appended (Monday's wire returns the block array
251
+ * directly under `Document.blocks`; the CLI surfaces it verbatim).
252
+ *
253
+ * `blocks` is non-null on the wire when the selection is requested;
254
+ * an empty doc surfaces `blocks: []` rather than `null`. The schema
255
+ * pins non-null for envelope predictability — an unexpected null
256
+ * surfaces `internal_error` at the IMPL parse boundary.
257
+ */
258
+ export const documentWithBlocksSchema = documentSchema
259
+ .extend({
260
+ blocks: z.array(documentBlockSchema),
261
+ })
262
+ .strict();
263
+ /**
264
+ * Output shape for `monday doc list [--workspace <wid>,...]
265
+ * [--order-by <created_at|used_at>] [--limit <n>] [--page <n>]`.
266
+ * Wrapped record (NOT bare array) because page/limit pagination
267
+ * surfaces pagination context inline rather than via `meta.cursor`
268
+ * (cli-design §6.1 cursor slot is for items_page-style surfaces;
269
+ * the workdocs wire has no cursor).
270
+ *
271
+ * `documents` — Monday's wire-ordered array (server-applied
272
+ * `created_at desc` or `used_at desc` per `--order-by`).
273
+ * `page` / `limit` — echoed inputs confirming what the wire saw.
274
+ * `returned_count` — `documents.length` cached for agent ergonomics.
275
+ * `has_more` — heuristic `returned_count === limit`; Monday's wire
276
+ * doesn't surface a total count, so "exactly `limit` rows returned"
277
+ * is the only signal that a follow-up page exists. Agents
278
+ * pessimistically re-fetch with `page + 1` if `has_more: true`.
279
+ */
280
+ export const docListOutputSchema = z
281
+ .object({
282
+ documents: z.array(documentSchema),
283
+ page: z.number().int().min(1),
284
+ limit: z
285
+ .number()
286
+ .int()
287
+ .min(MIN_DOC_LIST_LIMIT)
288
+ .max(MAX_DOC_LIST_LIMIT),
289
+ returned_count: z.number().int().min(0),
290
+ has_more: z.boolean(),
291
+ })
292
+ .strict()
293
+ // Pagination-invariant cross-field check (round-2 P2-1 fix +
294
+ // round-3 P2-1 guard). The schema-level field types/ranges don't
295
+ // enforce the documented invariants between `returned_count` /
296
+ // `documents.length` / `limit` / `has_more` — an IMPL bug could
297
+ // emit inconsistent pagination data and still pass output
298
+ // validation, then bleed agent-visible drift into the envelope.
299
+ // Pin the two invariants here so the unwrap-or-throw boundary
300
+ // catches violations at parse time:
301
+ //
302
+ // 1. `returned_count === documents.length` — the count field is
303
+ // the cached array length, not an independent counter.
304
+ // 2. `has_more === (returned_count === limit)` — Monday's wire
305
+ // surface doesn't expose a total-count, so "exactly `limit`
306
+ // rows returned" is the only signal that a follow-up page
307
+ // may exist (D9 closure).
308
+ //
309
+ // **Round-3 P2-1 fix — early-return guard.** Zod's `.superRefine`
310
+ // still runs even when scalar range checks above have produced
311
+ // "dirty" issues. Without this guard, a malformed input like
312
+ // `{ limit: 0, returned_count: 0, has_more: false }` would emit
313
+ // BOTH the legitimate `limit` range-floor violation AND a
314
+ // misleading `has_more` invariant violation (because `has_more
315
+ // === (returned_count === limit)` evaluates against the invalid
316
+ // limit value). Short-circuit when participating scalars are
317
+ // out-of-range so the user sees only the underlying range
318
+ // violation, not a derived inconsistency error stacked on top.
319
+ .superRefine((value, ctx) => {
320
+ if (value.limit < MIN_DOC_LIST_LIMIT ||
321
+ value.limit > MAX_DOC_LIST_LIMIT ||
322
+ value.returned_count < 0 ||
323
+ !Number.isInteger(value.limit) ||
324
+ !Number.isInteger(value.returned_count)) {
325
+ return;
326
+ }
327
+ if (value.returned_count !== value.documents.length) {
328
+ ctx.addIssue({
329
+ code: 'custom',
330
+ path: ['returned_count'],
331
+ message: `returned_count (${String(value.returned_count)}) must equal ` +
332
+ `documents.length (${String(value.documents.length)})`,
333
+ });
334
+ }
335
+ const expectedHasMore = value.returned_count === value.limit;
336
+ if (value.has_more !== expectedHasMore) {
337
+ ctx.addIssue({
338
+ code: 'custom',
339
+ path: ['has_more'],
340
+ message: `has_more (${String(value.has_more)}) must equal ` +
341
+ `(returned_count === limit) which is ${String(expectedHasMore)}`,
342
+ });
343
+ }
344
+ });
345
+ /**
346
+ * Output shape for `monday doc get <did>`. Direct unwrap of the
347
+ * single Document (with blocks hydrated) — matches the convention
348
+ * for read-one verbs (`monday board get <bid>` returns `data:
349
+ * <Board>`, `monday user get <uid>` returns `data: <User>`).
350
+ *
351
+ * The Document's own `id` field is the echoed input — no separate
352
+ * `doc_id` slot needed.
353
+ */
354
+ export const docGetOutputSchema = documentWithBlocksSchema;
355
+ /**
356
+ * GraphQL query document for `Query.docs(...)` listing variant.
357
+ * Operation name pinned literally to `ListDocs` and matches the
358
+ * wire `operationName` payload (R-NEW-37 W2 audit-point — caller-
359
+ * overridable operationName slots were closed at M27 IMPL round-1
360
+ * P2-1; M32 maintains the safely-by-construction shape).
361
+ *
362
+ * Selects every list-row field (no `blocks` selection — list rows
363
+ * project the 13-field base shape per D6). `workspace_ids:` typed
364
+ * as `[ID]` to mirror Monday's wire signature (the inner ID is
365
+ * nullable on Monday's side — an empirical-probe finding that
366
+ * doesn't show up in the contract today but stays preserved for
367
+ * future-proofing).
368
+ */
369
+ export const LIST_DOCS_QUERY = `
370
+ query ListDocs(
371
+ $workspaceIds: [ID],
372
+ $orderBy: DocsOrderBy,
373
+ $limit: Int,
374
+ $page: Int
375
+ ) {
376
+ docs(
377
+ workspace_ids: $workspaceIds,
378
+ order_by: $orderBy,
379
+ limit: $limit,
380
+ page: $page
381
+ ) {
382
+ id
383
+ object_id
384
+ name
385
+ doc_kind
386
+ url
387
+ relative_url
388
+ workspace_id
389
+ workspace { id name }
390
+ doc_folder_id
391
+ created_at
392
+ created_by { id name }
393
+ updated_at
394
+ settings
395
+ }
396
+ }
397
+ `;
398
+ /**
399
+ * GraphQL query document for `Query.docs(ids:)` single-id read
400
+ * variant. Operation name pinned to `GetDoc` (R-NEW-37 W2). Selects
401
+ * all base Document fields plus the `blocks` selection (the per-doc
402
+ * body-hydrating leg).
403
+ *
404
+ * Single-id wire shape — Monday returns `[Document]` (an array even
405
+ * for one id); the fetcher extracts index 0. An empty array
406
+ * (Monday's response for "doc not found" or "doc not visible to
407
+ * token") surfaces `not_found` with `details.doc_id`.
408
+ */
409
+ export const GET_DOC_QUERY = `
410
+ query GetDoc($ids: [ID!]!) {
411
+ docs(ids: $ids) {
412
+ id
413
+ object_id
414
+ name
415
+ doc_kind
416
+ url
417
+ relative_url
418
+ workspace_id
419
+ workspace { id name }
420
+ doc_folder_id
421
+ created_at
422
+ created_by { id name }
423
+ updated_at
424
+ settings
425
+ blocks {
426
+ id
427
+ type
428
+ content
429
+ position
430
+ parent_block_id
431
+ doc_id
432
+ created_at
433
+ created_by { id name }
434
+ updated_at
435
+ }
436
+ }
437
+ }
438
+ `;
439
+ /**
440
+ * Wrapping response schema for the `ListDocs` operation. Monday's
441
+ * documented wire shape is `[Document]` (an array, possibly empty)
442
+ * — never null. The wrapper accepts `null` defensively so a wire-
443
+ * shape regression parses cleanly and is rewrapped by the fetcher
444
+ * as `internal_error` with a drift hint (rather than faulting the
445
+ * parse with a confusing zod issue path). Both fetchers reject a
446
+ * null root post-parse; null is NEVER a `not_found` rewrap target
447
+ * — that's the empty-array D8 case in `getDocument`.
448
+ *
449
+ * `.loose()` mirrors the M27 `listWebhooksResponseSchema` cadence —
450
+ * Monday occasionally returns side-band debug keys (`extensions`,
451
+ * `account_id`) alongside the documented data root; the loose
452
+ * mode lets them pass without faulting the parse.
453
+ */
454
+ const listDocsResponseSchema = z
455
+ .object({
456
+ docs: z.array(documentSchema).nullable(),
457
+ })
458
+ .loose();
459
+ /**
460
+ * Wrapping response schema for the `GetDoc` operation. Same shape
461
+ * as the list variant but with `blocks` hydrated on every entry.
462
+ */
463
+ const getDocResponseSchema = z
464
+ .object({
465
+ docs: z.array(documentWithBlocksSchema).nullable(),
466
+ })
467
+ .loose();
468
+ /**
469
+ * Fetches the workdocs visible to the token via a single
470
+ * `Query.docs(...)` round-trip with `operationName: 'ListDocs'`
471
+ * (R-NEW-37 W2). Source is always `'live'` per cli-design §8 cache
472
+ * scope; workdocs aren't cached at v0.4 per D7.
473
+ *
474
+ * Variables map to Monday's wire `Query.docs(...)` args:
475
+ * `workspaceIds` → `workspace_ids: [ID]`; `orderBy` →
476
+ * `order_by: DocsOrderBy`; `limit` → `limit: Int`; `page` →
477
+ * `page: Int`. Omitted inputs drop the corresponding `$variable`
478
+ * so Monday's per-arg server-side default applies (rather than
479
+ * threading an explicit `null` that the wire treats as "field
480
+ * present").
481
+ *
482
+ * Echoed `page` / `limit` carry Monday's defaults when the caller
483
+ * omits them ({@link DEFAULT_DOC_LIST_LIMIT} for limit, `1` for
484
+ * page) so the envelope's pagination-invariant `.superRefine`
485
+ * sees consistent values regardless of which inputs the verb
486
+ * received.
487
+ *
488
+ * A null `docs` root surfaces `internal_error` (Monday's documented
489
+ * shape is `[Document]` even for empty accounts — the array, never
490
+ * null at this layer). Schema drift in the per-doc shape rewraps to
491
+ * `internal_error` with `details.issues` via `unwrapOrThrow`.
492
+ */
493
+ export const listDocuments = async (inputs) => {
494
+ const variables = {};
495
+ if (inputs.workspaceIds !== undefined) {
496
+ variables.workspaceIds = inputs.workspaceIds;
497
+ }
498
+ if (inputs.orderBy !== undefined) {
499
+ variables.orderBy = inputs.orderBy;
500
+ }
501
+ if (inputs.limit !== undefined) {
502
+ variables.limit = inputs.limit;
503
+ }
504
+ if (inputs.page !== undefined) {
505
+ variables.page = inputs.page;
506
+ }
507
+ const response = await inputs.client.raw(LIST_DOCS_QUERY, variables, { operationName: 'ListDocs' });
508
+ const parsed = unwrapOrThrow(listDocsResponseSchema.safeParse(response.data), {
509
+ context: 'Monday `Query.docs(ListDocs)` response',
510
+ hint: 'Monday may have amended the `Document` selection — re-probe and amend `src/api/documents.ts` if so',
511
+ });
512
+ if (parsed.docs === null) {
513
+ throw new ApiError('internal_error', 'Monday returned a null `docs` payload from ListDocs', {
514
+ details: {
515
+ hint: 'Monday\'s documented shape is `[Document]` (an array, possibly empty) — ' +
516
+ 'a null root indicates a wire change that needs re-probing',
517
+ },
518
+ });
519
+ }
520
+ return {
521
+ documents: parsed.docs,
522
+ page: inputs.page ?? 1,
523
+ limit: inputs.limit ?? DEFAULT_DOC_LIST_LIMIT,
524
+ source: 'live',
525
+ cacheAgeSeconds: null,
526
+ complexity: response.complexity,
527
+ };
528
+ };
529
+ /**
530
+ * Fetches a single workdoc by ID via a single `Query.docs(ids:)`
531
+ * round-trip with `operationName: 'GetDoc'` (R-NEW-37 W2). Returns
532
+ * the Document with `blocks` hydrated. Source is always `'live'`
533
+ * per cli-design §8 cache scope.
534
+ *
535
+ * Empty wire response (Monday's shape for "doc doesn't exist" OR
536
+ * "doc not visible to token") surfaces `not_found` with
537
+ * `details.doc_id` — no `forbidden` rewrap, because Monday's wire
538
+ * collapses the two cases into one shape and the CLI can't
539
+ * distinguish them per D8.
540
+ *
541
+ * A multi-element wire response (which Monday's `docs(ids:)`
542
+ * shouldn't return for a single-id query) surfaces `internal_error`
543
+ * as a defensive guard — the CLI assumes one doc per id and a
544
+ * count mismatch indicates a wire-shape regression worth surfacing
545
+ * loudly rather than silently dropping entries.
546
+ */
547
+ export const getDocument = async (inputs) => {
548
+ const response = await inputs.client.raw(GET_DOC_QUERY, { ids: [inputs.docId] }, { operationName: 'GetDoc' });
549
+ const parsed = unwrapOrThrow(getDocResponseSchema.safeParse(response.data), {
550
+ context: 'Monday `Query.docs(GetDoc)` response',
551
+ details: { doc_id: inputs.docId },
552
+ hint: 'Monday may have amended the `Document` / `DocumentBlock` selection — re-probe and amend `src/api/documents.ts` if so',
553
+ });
554
+ if (parsed.docs === null) {
555
+ throw new ApiError('internal_error', `Monday returned a null \`docs\` payload from GetDoc(${inputs.docId})`, {
556
+ details: {
557
+ doc_id: inputs.docId,
558
+ hint: 'Monday\'s documented shape is `[Document]` (an array, possibly empty) — ' +
559
+ 'a null root indicates a wire change that needs re-probing',
560
+ },
561
+ });
562
+ }
563
+ if (parsed.docs.length === 0) {
564
+ throw new ApiError('not_found', `workdoc ${inputs.docId} not found (does not exist or not visible to token)`, { details: { doc_id: inputs.docId } });
565
+ }
566
+ if (parsed.docs.length > 1) {
567
+ throw new ApiError('internal_error', `Monday returned ${String(parsed.docs.length)} docs for a single-id GetDoc query`, {
568
+ details: {
569
+ doc_id: inputs.docId,
570
+ hint: 'wire shape regression — re-probe `Query.docs(ids:)`',
571
+ },
572
+ });
573
+ }
574
+ const [document] = parsed.docs;
575
+ /* c8 ignore next 6 */
576
+ if (document === undefined) {
577
+ throw new ApiError('internal_error', `Monday returned a sparse docs array for GetDoc(${inputs.docId})`, { details: { doc_id: inputs.docId } });
578
+ }
579
+ return {
580
+ document,
581
+ source: 'live',
582
+ cacheAgeSeconds: null,
583
+ complexity: response.complexity,
584
+ };
585
+ };
586
+ //# sourceMappingURL=documents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documents.js","sourceRoot":"","sources":["../../src/api/documents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2GG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI3D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,uBAAuB,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,EAAE;IACzE,OAAO,EAAE,gEAAgE;CAC1E,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,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