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.
- package/CHANGELOG.md +439 -0
- package/LICENSE +21 -0
- package/README.md +431 -0
- package/dist/api/board-child-finder.d.ts +95 -0
- package/dist/api/board-child-finder.d.ts.map +1 -0
- package/dist/api/board-child-finder.js +89 -0
- package/dist/api/board-child-finder.js.map +1 -0
- package/dist/api/board-metadata.d.ts +162 -0
- package/dist/api/board-metadata.d.ts.map +1 -0
- package/dist/api/board-metadata.js +238 -0
- package/dist/api/board-metadata.js.map +1 -0
- package/dist/api/board-mutation-invalidation.d.ts +153 -0
- package/dist/api/board-mutation-invalidation.d.ts.map +1 -0
- package/dist/api/board-mutation-invalidation.js +136 -0
- package/dist/api/board-mutation-invalidation.js.map +1 -0
- package/dist/api/board-mutation-result.d.ts +97 -0
- package/dist/api/board-mutation-result.d.ts.map +1 -0
- package/dist/api/board-mutation-result.js +99 -0
- package/dist/api/board-mutation-result.js.map +1 -0
- package/dist/api/board-projection.d.ts +68 -0
- package/dist/api/board-projection.d.ts.map +1 -0
- package/dist/api/board-projection.js +79 -0
- package/dist/api/board-projection.js.map +1 -0
- package/dist/api/cache.d.ts +150 -0
- package/dist/api/cache.d.ts.map +1 -0
- package/dist/api/cache.js +418 -0
- package/dist/api/cache.js.map +1 -0
- package/dist/api/client.d.ts +162 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +205 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/column-mapping.d.ts +68 -0
- package/dist/api/column-mapping.d.ts.map +1 -0
- package/dist/api/column-mapping.js +117 -0
- package/dist/api/column-mapping.js.map +1 -0
- package/dist/api/column-mutation-result.d.ts +136 -0
- package/dist/api/column-mutation-result.d.ts.map +1 -0
- package/dist/api/column-mutation-result.js +130 -0
- package/dist/api/column-mutation-result.js.map +1 -0
- package/dist/api/column-types.d.ts +215 -0
- package/dist/api/column-types.d.ts.map +1 -0
- package/dist/api/column-types.js +195 -0
- package/dist/api/column-types.js.map +1 -0
- package/dist/api/column-values.d.ts +446 -0
- package/dist/api/column-values.d.ts.map +1 -0
- package/dist/api/column-values.js +795 -0
- package/dist/api/column-values.js.map +1 -0
- package/dist/api/columns.d.ts +205 -0
- package/dist/api/columns.d.ts.map +1 -0
- package/dist/api/columns.js +343 -0
- package/dist/api/columns.js.map +1 -0
- package/dist/api/complexity.d.ts +90 -0
- package/dist/api/complexity.d.ts.map +1 -0
- package/dist/api/complexity.js +194 -0
- package/dist/api/complexity.js.map +1 -0
- package/dist/api/dates.d.ts +150 -0
- package/dist/api/dates.d.ts.map +1 -0
- package/dist/api/dates.js +490 -0
- package/dist/api/dates.js.map +1 -0
- package/dist/api/destructive-gate.d.ts +107 -0
- package/dist/api/destructive-gate.d.ts.map +1 -0
- package/dist/api/destructive-gate.js +19 -0
- package/dist/api/destructive-gate.js.map +1 -0
- package/dist/api/dry-run.d.ts +338 -0
- package/dist/api/dry-run.d.ts.map +1 -0
- package/dist/api/dry-run.js +607 -0
- package/dist/api/dry-run.js.map +1 -0
- package/dist/api/emails.d.ts +60 -0
- package/dist/api/emails.d.ts.map +1 -0
- package/dist/api/emails.js +113 -0
- package/dist/api/emails.js.map +1 -0
- package/dist/api/errors.d.ts +82 -0
- package/dist/api/errors.d.ts.map +1 -0
- package/dist/api/errors.js +434 -0
- package/dist/api/errors.js.map +1 -0
- package/dist/api/filters.d.ts +198 -0
- package/dist/api/filters.d.ts.map +1 -0
- package/dist/api/filters.js +328 -0
- package/dist/api/filters.js.map +1 -0
- package/dist/api/group-color.d.ts +33 -0
- package/dist/api/group-color.d.ts.map +1 -0
- package/dist/api/group-color.js +80 -0
- package/dist/api/group-color.js.map +1 -0
- package/dist/api/group-mutation-result.d.ts +150 -0
- package/dist/api/group-mutation-result.d.ts.map +1 -0
- package/dist/api/group-mutation-result.js +141 -0
- package/dist/api/group-mutation-result.js.map +1 -0
- package/dist/api/iso-country-codes.d.ts +45 -0
- package/dist/api/iso-country-codes.d.ts.map +1 -0
- package/dist/api/iso-country-codes.js +71 -0
- package/dist/api/iso-country-codes.js.map +1 -0
- package/dist/api/item-board-lookup.d.ts +86 -0
- package/dist/api/item-board-lookup.d.ts.map +1 -0
- package/dist/api/item-board-lookup.js +140 -0
- package/dist/api/item-board-lookup.js.map +1 -0
- package/dist/api/item-helpers.d.ts +133 -0
- package/dist/api/item-helpers.d.ts.map +1 -0
- package/dist/api/item-helpers.js +139 -0
- package/dist/api/item-helpers.js.map +1 -0
- package/dist/api/item-mutation-result.d.ts +60 -0
- package/dist/api/item-mutation-result.d.ts.map +1 -0
- package/dist/api/item-mutation-result.js +63 -0
- package/dist/api/item-mutation-result.js.map +1 -0
- package/dist/api/item-projection.d.ts +165 -0
- package/dist/api/item-projection.d.ts.map +1 -0
- package/dist/api/item-projection.js +235 -0
- package/dist/api/item-projection.js.map +1 -0
- package/dist/api/item-source-read.d.ts +45 -0
- package/dist/api/item-source-read.d.ts.map +1 -0
- package/dist/api/item-source-read.js +57 -0
- package/dist/api/item-source-read.js.map +1 -0
- package/dist/api/items-page-walker.d.ts +126 -0
- package/dist/api/items-page-walker.d.ts.map +1 -0
- package/dist/api/items-page-walker.js +256 -0
- package/dist/api/items-page-walker.js.map +1 -0
- package/dist/api/links.d.ts +70 -0
- package/dist/api/links.d.ts.map +1 -0
- package/dist/api/links.js +128 -0
- package/dist/api/links.js.map +1 -0
- package/dist/api/me-token.d.ts +52 -0
- package/dist/api/me-token.d.ts.map +1 -0
- package/dist/api/me-token.js +55 -0
- package/dist/api/me-token.js.map +1 -0
- package/dist/api/pagination.d.ts +201 -0
- package/dist/api/pagination.d.ts.map +1 -0
- package/dist/api/pagination.js +223 -0
- package/dist/api/pagination.js.map +1 -0
- package/dist/api/partial-success-mutation.d.ts +28 -0
- package/dist/api/partial-success-mutation.d.ts.map +1 -0
- package/dist/api/partial-success-mutation.js +68 -0
- package/dist/api/partial-success-mutation.js.map +1 -0
- package/dist/api/people.d.ts +182 -0
- package/dist/api/people.d.ts.map +1 -0
- package/dist/api/people.js +260 -0
- package/dist/api/people.js.map +1 -0
- package/dist/api/phones.d.ts +74 -0
- package/dist/api/phones.d.ts.map +1 -0
- package/dist/api/phones.js +167 -0
- package/dist/api/phones.js.map +1 -0
- package/dist/api/raw-document.d.ts +53 -0
- package/dist/api/raw-document.d.ts.map +1 -0
- package/dist/api/raw-document.js +177 -0
- package/dist/api/raw-document.js.map +1 -0
- package/dist/api/raw-write.d.ts +127 -0
- package/dist/api/raw-write.d.ts.map +1 -0
- package/dist/api/raw-write.js +233 -0
- package/dist/api/raw-write.js.map +1 -0
- package/dist/api/resolution-context.d.ts +32 -0
- package/dist/api/resolution-context.d.ts.map +1 -0
- package/dist/api/resolution-context.js +42 -0
- package/dist/api/resolution-context.js.map +1 -0
- package/dist/api/resolution-pass.d.ts +163 -0
- package/dist/api/resolution-pass.d.ts.map +1 -0
- package/dist/api/resolution-pass.js +254 -0
- package/dist/api/resolution-pass.js.map +1 -0
- package/dist/api/resolve-client.d.ts +69 -0
- package/dist/api/resolve-client.d.ts.map +1 -0
- package/dist/api/resolve-client.js +70 -0
- package/dist/api/resolve-client.js.map +1 -0
- package/dist/api/resolver-error-fold.d.ts +176 -0
- package/dist/api/resolver-error-fold.d.ts.map +1 -0
- package/dist/api/resolver-error-fold.js +230 -0
- package/dist/api/resolver-error-fold.js.map +1 -0
- package/dist/api/resolvers.d.ts +131 -0
- package/dist/api/resolvers.d.ts.map +1 -0
- package/dist/api/resolvers.js +262 -0
- package/dist/api/resolvers.js.map +1 -0
- package/dist/api/response-root.d.ts +65 -0
- package/dist/api/response-root.d.ts.map +1 -0
- package/dist/api/response-root.js +61 -0
- package/dist/api/response-root.js.map +1 -0
- package/dist/api/retry.d.ts +112 -0
- package/dist/api/retry.d.ts.map +1 -0
- package/dist/api/retry.js +181 -0
- package/dist/api/retry.js.map +1 -0
- package/dist/api/set-expression.d.ts +23 -0
- package/dist/api/set-expression.d.ts.map +1 -0
- package/dist/api/set-expression.js +31 -0
- package/dist/api/set-expression.js.map +1 -0
- package/dist/api/sort.d.ts +59 -0
- package/dist/api/sort.d.ts.map +1 -0
- package/dist/api/sort.js +73 -0
- package/dist/api/sort.js.map +1 -0
- package/dist/api/source-aggregator.d.ts +94 -0
- package/dist/api/source-aggregator.d.ts.map +1 -0
- package/dist/api/source-aggregator.js +111 -0
- package/dist/api/source-aggregator.js.map +1 -0
- package/dist/api/transport.d.ts +58 -0
- package/dist/api/transport.d.ts.map +1 -0
- package/dist/api/transport.js +190 -0
- package/dist/api/transport.js.map +1 -0
- package/dist/api/update-mutation-result.d.ts +133 -0
- package/dist/api/update-mutation-result.d.ts.map +1 -0
- package/dist/api/update-mutation-result.js +145 -0
- package/dist/api/update-mutation-result.js.map +1 -0
- package/dist/api/users-fan-out-mutation.d.ts +124 -0
- package/dist/api/users-fan-out-mutation.d.ts.map +1 -0
- package/dist/api/users-fan-out-mutation.js +331 -0
- package/dist/api/users-fan-out-mutation.js.map +1 -0
- package/dist/api/walk-pages.d.ts +91 -0
- package/dist/api/walk-pages.d.ts.map +1 -0
- package/dist/api/walk-pages.js +84 -0
- package/dist/api/walk-pages.js.map +1 -0
- package/dist/api/workspace-projection.d.ts +64 -0
- package/dist/api/workspace-projection.d.ts.map +1 -0
- package/dist/api/workspace-projection.js +83 -0
- package/dist/api/workspace-projection.js.map +1 -0
- package/dist/cli/envelope-out.d.ts +128 -0
- package/dist/cli/envelope-out.d.ts.map +1 -0
- package/dist/cli/envelope-out.js +146 -0
- package/dist/cli/envelope-out.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +27 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/program.d.ts +29 -0
- package/dist/cli/program.d.ts.map +1 -0
- package/dist/cli/program.js +109 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/run.d.ts +108 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +105 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/commands/account/client-helper.d.ts +37 -0
- package/dist/commands/account/client-helper.d.ts.map +1 -0
- package/dist/commands/account/client-helper.js +55 -0
- package/dist/commands/account/client-helper.js.map +1 -0
- package/dist/commands/account/complexity.d.ts +29 -0
- package/dist/commands/account/complexity.d.ts.map +1 -0
- package/dist/commands/account/complexity.js +70 -0
- package/dist/commands/account/complexity.js.map +1 -0
- package/dist/commands/account/info.d.ts +36 -0
- package/dist/commands/account/info.d.ts.map +1 -0
- package/dist/commands/account/info.js +74 -0
- package/dist/commands/account/info.js.map +1 -0
- package/dist/commands/account/version.d.ts +44 -0
- package/dist/commands/account/version.d.ts.map +1 -0
- package/dist/commands/account/version.js +98 -0
- package/dist/commands/account/version.js.map +1 -0
- package/dist/commands/account/whoami.d.ts +34 -0
- package/dist/commands/account/whoami.d.ts.map +1 -0
- package/dist/commands/account/whoami.js +77 -0
- package/dist/commands/account/whoami.js.map +1 -0
- package/dist/commands/board/add-users.d.ts +60 -0
- package/dist/commands/board/add-users.d.ts.map +1 -0
- package/dist/commands/board/add-users.js +133 -0
- package/dist/commands/board/add-users.js.map +1 -0
- package/dist/commands/board/archive.d.ts +64 -0
- package/dist/commands/board/archive.d.ts.map +1 -0
- package/dist/commands/board/archive.js +226 -0
- package/dist/commands/board/archive.js.map +1 -0
- package/dist/commands/board/column-create.d.ts +146 -0
- package/dist/commands/board/column-create.d.ts.map +1 -0
- package/dist/commands/board/column-create.js +564 -0
- package/dist/commands/board/column-create.js.map +1 -0
- package/dist/commands/board/column-delete.d.ts +76 -0
- package/dist/commands/board/column-delete.d.ts.map +1 -0
- package/dist/commands/board/column-delete.js +224 -0
- package/dist/commands/board/column-delete.js.map +1 -0
- package/dist/commands/board/column-update.d.ts +92 -0
- package/dist/commands/board/column-update.d.ts.map +1 -0
- package/dist/commands/board/column-update.js +364 -0
- package/dist/commands/board/column-update.js.map +1 -0
- package/dist/commands/board/columns.d.ts +30 -0
- package/dist/commands/board/columns.d.ts.map +1 -0
- package/dist/commands/board/columns.js +102 -0
- package/dist/commands/board/columns.js.map +1 -0
- package/dist/commands/board/create.d.ts +67 -0
- package/dist/commands/board/create.d.ts.map +1 -0
- package/dist/commands/board/create.js +226 -0
- package/dist/commands/board/create.js.map +1 -0
- package/dist/commands/board/delete.d.ts +60 -0
- package/dist/commands/board/delete.d.ts.map +1 -0
- package/dist/commands/board/delete.js +192 -0
- package/dist/commands/board/delete.js.map +1 -0
- package/dist/commands/board/describe.d.ts +68 -0
- package/dist/commands/board/describe.d.ts.map +1 -0
- package/dist/commands/board/describe.js +241 -0
- package/dist/commands/board/describe.js.map +1 -0
- package/dist/commands/board/doctor.d.ts +108 -0
- package/dist/commands/board/doctor.d.ts.map +1 -0
- package/dist/commands/board/doctor.js +417 -0
- package/dist/commands/board/doctor.js.map +1 -0
- package/dist/commands/board/duplicate.d.ts +85 -0
- package/dist/commands/board/duplicate.d.ts.map +1 -0
- package/dist/commands/board/duplicate.js +281 -0
- package/dist/commands/board/duplicate.js.map +1 -0
- package/dist/commands/board/find.d.ts +47 -0
- package/dist/commands/board/find.d.ts.map +1 -0
- package/dist/commands/board/find.js +153 -0
- package/dist/commands/board/find.js.map +1 -0
- package/dist/commands/board/get.d.ts +41 -0
- package/dist/commands/board/get.d.ts.map +1 -0
- package/dist/commands/board/get.js +66 -0
- package/dist/commands/board/get.js.map +1 -0
- package/dist/commands/board/group-archive.d.ts +83 -0
- package/dist/commands/board/group-archive.d.ts.map +1 -0
- package/dist/commands/board/group-archive.js +264 -0
- package/dist/commands/board/group-archive.js.map +1 -0
- package/dist/commands/board/group-create.d.ts +118 -0
- package/dist/commands/board/group-create.d.ts.map +1 -0
- package/dist/commands/board/group-create.js +239 -0
- package/dist/commands/board/group-create.js.map +1 -0
- package/dist/commands/board/group-delete.d.ts +79 -0
- package/dist/commands/board/group-delete.d.ts.map +1 -0
- package/dist/commands/board/group-delete.js +222 -0
- package/dist/commands/board/group-delete.js.map +1 -0
- package/dist/commands/board/group-duplicate.d.ts +70 -0
- package/dist/commands/board/group-duplicate.d.ts.map +1 -0
- package/dist/commands/board/group-duplicate.js +219 -0
- package/dist/commands/board/group-duplicate.js.map +1 -0
- package/dist/commands/board/group-update.d.ts +145 -0
- package/dist/commands/board/group-update.d.ts.map +1 -0
- package/dist/commands/board/group-update.js +341 -0
- package/dist/commands/board/group-update.js.map +1 -0
- package/dist/commands/board/groups.d.ts +28 -0
- package/dist/commands/board/groups.d.ts.map +1 -0
- package/dist/commands/board/groups.js +85 -0
- package/dist/commands/board/groups.js.map +1 -0
- package/dist/commands/board/list.d.ts +39 -0
- package/dist/commands/board/list.d.ts.map +1 -0
- package/dist/commands/board/list.js +135 -0
- package/dist/commands/board/list.js.map +1 -0
- package/dist/commands/board/subscribers.d.ts +24 -0
- package/dist/commands/board/subscribers.d.ts.map +1 -0
- package/dist/commands/board/subscribers.js +89 -0
- package/dist/commands/board/subscribers.js.map +1 -0
- package/dist/commands/board/update.d.ts +82 -0
- package/dist/commands/board/update.d.ts.map +1 -0
- package/dist/commands/board/update.js +328 -0
- package/dist/commands/board/update.js.map +1 -0
- package/dist/commands/cache/clear.d.ts +34 -0
- package/dist/commands/cache/clear.d.ts.map +1 -0
- package/dist/commands/cache/clear.js +113 -0
- package/dist/commands/cache/clear.js.map +1 -0
- package/dist/commands/cache/list.d.ts +50 -0
- package/dist/commands/cache/list.d.ts.map +1 -0
- package/dist/commands/cache/list.js +77 -0
- package/dist/commands/cache/list.js.map +1 -0
- package/dist/commands/cache/stats.d.ts +22 -0
- package/dist/commands/cache/stats.d.ts.map +1 -0
- package/dist/commands/cache/stats.js +56 -0
- package/dist/commands/cache/stats.js.map +1 -0
- package/dist/commands/config/path.d.ts +22 -0
- package/dist/commands/config/path.d.ts.map +1 -0
- package/dist/commands/config/path.js +74 -0
- package/dist/commands/config/path.js.map +1 -0
- package/dist/commands/config/show.d.ts +61 -0
- package/dist/commands/config/show.d.ts.map +1 -0
- package/dist/commands/config/show.js +137 -0
- package/dist/commands/config/show.js.map +1 -0
- package/dist/commands/emit.d.ts +156 -0
- package/dist/commands/emit.d.ts.map +1 -0
- package/dist/commands/emit.js +212 -0
- package/dist/commands/emit.js.map +1 -0
- package/dist/commands/index.d.ts +5 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +195 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/item/archive.d.ts +81 -0
- package/dist/commands/item/archive.d.ts.map +1 -0
- package/dist/commands/item/archive.js +187 -0
- package/dist/commands/item/archive.js.map +1 -0
- package/dist/commands/item/clear.d.ts +140 -0
- package/dist/commands/item/clear.d.ts.map +1 -0
- package/dist/commands/item/clear.js +748 -0
- package/dist/commands/item/clear.js.map +1 -0
- package/dist/commands/item/create.d.ts +77 -0
- package/dist/commands/item/create.d.ts.map +1 -0
- package/dist/commands/item/create.js +802 -0
- package/dist/commands/item/create.js.map +1 -0
- package/dist/commands/item/delete.d.ts +82 -0
- package/dist/commands/item/delete.d.ts.map +1 -0
- package/dist/commands/item/delete.js +179 -0
- package/dist/commands/item/delete.js.map +1 -0
- package/dist/commands/item/duplicate.d.ts +117 -0
- package/dist/commands/item/duplicate.d.ts.map +1 -0
- package/dist/commands/item/duplicate.js +238 -0
- package/dist/commands/item/duplicate.js.map +1 -0
- package/dist/commands/item/find.d.ts +55 -0
- package/dist/commands/item/find.d.ts.map +1 -0
- package/dist/commands/item/find.js +231 -0
- package/dist/commands/item/find.js.map +1 -0
- package/dist/commands/item/get.d.ts +47 -0
- package/dist/commands/item/get.d.ts.map +1 -0
- package/dist/commands/item/get.js +66 -0
- package/dist/commands/item/get.js.map +1 -0
- package/dist/commands/item/list.d.ts +73 -0
- package/dist/commands/item/list.d.ts.map +1 -0
- package/dist/commands/item/list.js +284 -0
- package/dist/commands/item/list.js.map +1 -0
- package/dist/commands/item/move.d.ts +181 -0
- package/dist/commands/item/move.d.ts.map +1 -0
- package/dist/commands/item/move.js +560 -0
- package/dist/commands/item/move.js.map +1 -0
- package/dist/commands/item/search.d.ts +67 -0
- package/dist/commands/item/search.d.ts.map +1 -0
- package/dist/commands/item/search.js +322 -0
- package/dist/commands/item/search.js.map +1 -0
- package/dist/commands/item/set.d.ts +88 -0
- package/dist/commands/item/set.d.ts.map +1 -0
- package/dist/commands/item/set.js +387 -0
- package/dist/commands/item/set.js.map +1 -0
- package/dist/commands/item/subitems.d.ts +50 -0
- package/dist/commands/item/subitems.d.ts.map +1 -0
- package/dist/commands/item/subitems.js +86 -0
- package/dist/commands/item/subitems.js.map +1 -0
- package/dist/commands/item/update.d.ts +99 -0
- package/dist/commands/item/update.d.ts.map +1 -0
- package/dist/commands/item/update.js +884 -0
- package/dist/commands/item/update.js.map +1 -0
- package/dist/commands/item/upsert.d.ts +105 -0
- package/dist/commands/item/upsert.d.ts.map +1 -0
- package/dist/commands/item/upsert.js +998 -0
- package/dist/commands/item/upsert.js.map +1 -0
- package/dist/commands/parse-argv.d.ts +20 -0
- package/dist/commands/parse-argv.d.ts.map +1 -0
- package/dist/commands/parse-argv.js +40 -0
- package/dist/commands/parse-argv.js.map +1 -0
- package/dist/commands/raw/index.d.ts +23 -0
- package/dist/commands/raw/index.d.ts.map +1 -0
- package/dist/commands/raw/index.js +416 -0
- package/dist/commands/raw/index.js.map +1 -0
- package/dist/commands/run-by-id-lookup.d.ts +72 -0
- package/dist/commands/run-by-id-lookup.d.ts.map +1 -0
- package/dist/commands/run-by-id-lookup.js +58 -0
- package/dist/commands/run-by-id-lookup.js.map +1 -0
- package/dist/commands/schema/index.d.ts +104 -0
- package/dist/commands/schema/index.d.ts.map +1 -0
- package/dist/commands/schema/index.js +183 -0
- package/dist/commands/schema/index.js.map +1 -0
- package/dist/commands/types.d.ts +66 -0
- package/dist/commands/types.d.ts.map +1 -0
- package/dist/commands/types.js +15 -0
- package/dist/commands/types.js.map +1 -0
- package/dist/commands/update/body-source.d.ts +38 -0
- package/dist/commands/update/body-source.d.ts.map +1 -0
- package/dist/commands/update/body-source.js +80 -0
- package/dist/commands/update/body-source.js.map +1 -0
- package/dist/commands/update/clear-all.d.ts +67 -0
- package/dist/commands/update/clear-all.d.ts.map +1 -0
- package/dist/commands/update/clear-all.js +281 -0
- package/dist/commands/update/clear-all.js.map +1 -0
- package/dist/commands/update/create.d.ts +51 -0
- package/dist/commands/update/create.d.ts.map +1 -0
- package/dist/commands/update/create.js +167 -0
- package/dist/commands/update/create.js.map +1 -0
- package/dist/commands/update/delete.d.ts +53 -0
- package/dist/commands/update/delete.d.ts.map +1 -0
- package/dist/commands/update/delete.js +148 -0
- package/dist/commands/update/delete.js.map +1 -0
- package/dist/commands/update/edit.d.ts +37 -0
- package/dist/commands/update/edit.d.ts.map +1 -0
- package/dist/commands/update/edit.js +129 -0
- package/dist/commands/update/edit.js.map +1 -0
- package/dist/commands/update/get.d.ts +37 -0
- package/dist/commands/update/get.d.ts.map +1 -0
- package/dist/commands/update/get.js +92 -0
- package/dist/commands/update/get.js.map +1 -0
- package/dist/commands/update/like.d.ts +17 -0
- package/dist/commands/update/like.d.ts.map +1 -0
- package/dist/commands/update/like.js +23 -0
- package/dist/commands/update/like.js.map +1 -0
- package/dist/commands/update/list.d.ts +58 -0
- package/dist/commands/update/list.d.ts.map +1 -0
- package/dist/commands/update/list.js +322 -0
- package/dist/commands/update/list.js.map +1 -0
- package/dist/commands/update/pin.d.ts +17 -0
- package/dist/commands/update/pin.d.ts.map +1 -0
- package/dist/commands/update/pin.js +23 -0
- package/dist/commands/update/pin.js.map +1 -0
- package/dist/commands/update/reply.d.ts +47 -0
- package/dist/commands/update/reply.d.ts.map +1 -0
- package/dist/commands/update/reply.js +149 -0
- package/dist/commands/update/reply.js.map +1 -0
- package/dist/commands/update/toggle.d.ts +70 -0
- package/dist/commands/update/toggle.d.ts.map +1 -0
- package/dist/commands/update/toggle.js +118 -0
- package/dist/commands/update/toggle.js.map +1 -0
- package/dist/commands/update/unlike.d.ts +17 -0
- package/dist/commands/update/unlike.d.ts.map +1 -0
- package/dist/commands/update/unlike.js +22 -0
- package/dist/commands/update/unlike.js.map +1 -0
- package/dist/commands/update/unpin.d.ts +17 -0
- package/dist/commands/update/unpin.d.ts.map +1 -0
- package/dist/commands/update/unpin.js +21 -0
- package/dist/commands/update/unpin.js.map +1 -0
- package/dist/commands/user/get.d.ts +31 -0
- package/dist/commands/user/get.d.ts.map +1 -0
- package/dist/commands/user/get.js +81 -0
- package/dist/commands/user/get.js.map +1 -0
- package/dist/commands/user/list.d.ts +61 -0
- package/dist/commands/user/list.d.ts.map +1 -0
- package/dist/commands/user/list.js +148 -0
- package/dist/commands/user/list.js.map +1 -0
- package/dist/commands/user/me.d.ts +17 -0
- package/dist/commands/user/me.d.ts.map +1 -0
- package/dist/commands/user/me.js +49 -0
- package/dist/commands/user/me.js.map +1 -0
- package/dist/commands/workspace/add-users.d.ts +76 -0
- package/dist/commands/workspace/add-users.d.ts.map +1 -0
- package/dist/commands/workspace/add-users.js +154 -0
- package/dist/commands/workspace/add-users.js.map +1 -0
- package/dist/commands/workspace/create.d.ts +59 -0
- package/dist/commands/workspace/create.d.ts.map +1 -0
- package/dist/commands/workspace/create.js +163 -0
- package/dist/commands/workspace/create.js.map +1 -0
- package/dist/commands/workspace/delete.d.ts +67 -0
- package/dist/commands/workspace/delete.d.ts.map +1 -0
- package/dist/commands/workspace/delete.js +182 -0
- package/dist/commands/workspace/delete.js.map +1 -0
- package/dist/commands/workspace/folders.d.ts +40 -0
- package/dist/commands/workspace/folders.d.ts.map +1 -0
- package/dist/commands/workspace/folders.js +124 -0
- package/dist/commands/workspace/folders.js.map +1 -0
- package/dist/commands/workspace/get.d.ts +35 -0
- package/dist/commands/workspace/get.d.ts.map +1 -0
- package/dist/commands/workspace/get.js +62 -0
- package/dist/commands/workspace/get.js.map +1 -0
- package/dist/commands/workspace/list.d.ts +57 -0
- package/dist/commands/workspace/list.d.ts.map +1 -0
- package/dist/commands/workspace/list.js +125 -0
- package/dist/commands/workspace/list.js.map +1 -0
- package/dist/commands/workspace/remove-users.d.ts +47 -0
- package/dist/commands/workspace/remove-users.d.ts.map +1 -0
- package/dist/commands/workspace/remove-users.js +122 -0
- package/dist/commands/workspace/remove-users.js.map +1 -0
- package/dist/commands/workspace/update.d.ts +68 -0
- package/dist/commands/workspace/update.d.ts.map +1 -0
- package/dist/commands/workspace/update.js +237 -0
- package/dist/commands/workspace/update.js.map +1 -0
- package/dist/config/load.d.ts +33 -0
- package/dist/config/load.d.ts.map +1 -0
- package/dist/config/load.js +81 -0
- package/dist/config/load.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/types/global-flags.d.ts +69 -0
- package/dist/types/global-flags.d.ts.map +1 -0
- package/dist/types/global-flags.js +170 -0
- package/dist/types/global-flags.js.map +1 -0
- package/dist/types/ids.d.ts +38 -0
- package/dist/types/ids.d.ts.map +1 -0
- package/dist/types/ids.js +51 -0
- package/dist/types/ids.js.map +1 -0
- package/dist/types/json.d.ts +60 -0
- package/dist/types/json.d.ts.map +1 -0
- package/dist/types/json.js +33 -0
- package/dist/types/json.js.map +1 -0
- package/dist/utils/errors.d.ts +121 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +264 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/logger.d.ts +39 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +49 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/output/envelope.d.ts +140 -0
- package/dist/utils/output/envelope.d.ts.map +1 -0
- package/dist/utils/output/envelope.js +120 -0
- package/dist/utils/output/envelope.js.map +1 -0
- package/dist/utils/output/json.d.ts +10 -0
- package/dist/utils/output/json.d.ts.map +1 -0
- package/dist/utils/output/json.js +12 -0
- package/dist/utils/output/json.js.map +1 -0
- package/dist/utils/output/ndjson.d.ts +92 -0
- package/dist/utils/output/ndjson.d.ts.map +1 -0
- package/dist/utils/output/ndjson.js +33 -0
- package/dist/utils/output/ndjson.js.map +1 -0
- package/dist/utils/output/select.d.ts +22 -0
- package/dist/utils/output/select.d.ts.map +1 -0
- package/dist/utils/output/select.js +47 -0
- package/dist/utils/output/select.js.map +1 -0
- package/dist/utils/output/table.d.ts +32 -0
- package/dist/utils/output/table.d.ts.map +1 -0
- package/dist/utils/output/table.js +133 -0
- package/dist/utils/output/table.js.map +1 -0
- package/dist/utils/output/text.d.ts +5 -0
- package/dist/utils/output/text.d.ts.map +1 -0
- package/dist/utils/output/text.js +32 -0
- package/dist/utils/output/text.js.map +1 -0
- package/dist/utils/parse-boundary.d.ts +53 -0
- package/dist/utils/parse-boundary.d.ts.map +1 -0
- package/dist/utils/parse-boundary.js +62 -0
- package/dist/utils/parse-boundary.js.map +1 -0
- package/dist/utils/redact.d.ts +54 -0
- package/dist/utils/redact.d.ts.map +1 -0
- package/dist/utils/redact.js +154 -0
- package/dist/utils/redact.js.map +1 -0
- package/dist/utils/request-id.d.ts +17 -0
- package/dist/utils/request-id.d.ts.map +1 -0
- package/dist/utils/request-id.js +26 -0
- package/dist/utils/request-id.js.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,802 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `monday item create` — create a new item or subitem
|
|
3
|
+
* (`cli-design.md` §4.3 + §5.3 + §5.8 + §6.4 "Item-create shape",
|
|
4
|
+
* `v0.2-plan.md` §3 M9).
|
|
5
|
+
*
|
|
6
|
+
* Two argv shapes the dispatch picks between:
|
|
7
|
+
*
|
|
8
|
+
* 1. **Top-level** — `--board <bid> --name <n>` mandatory; optional
|
|
9
|
+
* `--group`, `--position before|after --relative-to <iid>`,
|
|
10
|
+
* `--set`, `--set-raw`. Calls `create_item`. Resolves columns
|
|
11
|
+
* against `--board`'s metadata.
|
|
12
|
+
*
|
|
13
|
+
* 2. **Subitem** — `--parent <iid> --name <n>` mandatory; `--set` /
|
|
14
|
+
* `--set-raw` optional. `--board`, `--group`, and
|
|
15
|
+
* `--position` / `--relative-to` are **rejected** here — subitems
|
|
16
|
+
* live on Monday's auto-generated subitems board (not in groups,
|
|
17
|
+
* not relative to arbitrary items, not on a caller-named board).
|
|
18
|
+
* Calls `create_subitem`. Resolves columns against the
|
|
19
|
+
* subitems-board's metadata (derived from the parent's
|
|
20
|
+
* `subtasks` column's `settings_str.boardIds[0]`). Multi-level
|
|
21
|
+
* boards (`hierarchy_type: "multi_level"`) are rejected with
|
|
22
|
+
* `usage_error` — multi-level subitem support is deferred to
|
|
23
|
+
* v0.3 because the column-resolution path here assumes the
|
|
24
|
+
* classic auto-generated-subitems-board model.
|
|
25
|
+
*
|
|
26
|
+
* **Single round-trip** (cli-design §5.8 — hard exit gate). Every
|
|
27
|
+
* translated `--set` / `--set-raw` value bundles into one
|
|
28
|
+
* `create_item.column_values` (or `create_subitem.column_values`)
|
|
29
|
+
* parameter via `bundleColumnValues`; the CLI does **not** fall back
|
|
30
|
+
* to `create_item` + `change_multiple_column_values` on partial
|
|
31
|
+
* failure. Monday's server-side rejection of any value fails the
|
|
32
|
+
* whole mutation, and no item is created — agents retry with the
|
|
33
|
+
* value fixed.
|
|
34
|
+
*
|
|
35
|
+
* **`--position` / `--relative-to` cross-validation.** Both flags
|
|
36
|
+
* are required together (one without the other → `usage_error`).
|
|
37
|
+
* `--relative-to` must reference an item on the same board (mirrors
|
|
38
|
+
* the M5b wrong-board check).
|
|
39
|
+
*
|
|
40
|
+
* **Mutation envelope** (cli-design §6.4 + §5.3 step 2). `data: {id,
|
|
41
|
+
* name, board_id, group_id, parent_id?}` with the top-level
|
|
42
|
+
* `resolved_ids` echo (token → resolved column ID) for every `--set`
|
|
43
|
+
* / `--set-raw` token the agent supplied. `parent_id` is present
|
|
44
|
+
* only on the subitem path.
|
|
45
|
+
*
|
|
46
|
+
* **Idempotent: false.** Re-running with the same args creates a
|
|
47
|
+
* second item. Agents needing idempotent create-or-update use
|
|
48
|
+
* `monday item upsert` (M12).
|
|
49
|
+
*/
|
|
50
|
+
import { z } from 'zod';
|
|
51
|
+
import { ensureSubcommand } from '../types.js';
|
|
52
|
+
import { emitDryRun, emitMutation } from '../emit.js';
|
|
53
|
+
import { resolveClient } from '../../api/resolve-client.js';
|
|
54
|
+
import { BoardIdSchema, ItemIdSchema } from '../../types/ids.js';
|
|
55
|
+
import { parseArgv } from '../parse-argv.js';
|
|
56
|
+
import { ApiError, MondayCliError, UsageError } from '../../utils/errors.js';
|
|
57
|
+
import { bundleColumnValues, } from '../../api/column-values.js';
|
|
58
|
+
import { parseSetRawExpression, } from '../../api/raw-write.js';
|
|
59
|
+
import { splitSetExpression } from '../../api/set-expression.js';
|
|
60
|
+
import { buildResolutionContexts } from '../../api/resolution-context.js';
|
|
61
|
+
import { lookupItemBoard, lookupItemBoardWithHierarchy, } from '../../api/item-board-lookup.js';
|
|
62
|
+
import { SourceAggregator, mergeSourceWithPreflight, mergeCacheAge, } from '../../api/source-aggregator.js';
|
|
63
|
+
import { resolveAndTranslate } from '../../api/resolution-pass.js';
|
|
64
|
+
import { foldAndRemap } from '../../api/resolver-error-fold.js';
|
|
65
|
+
import { planCreate } from '../../api/dry-run.js';
|
|
66
|
+
import { loadBoardMetadata } from '../../api/board-metadata.js';
|
|
67
|
+
import { unwrapOrThrow } from '../../utils/parse-boundary.js';
|
|
68
|
+
// ============================================================
|
|
69
|
+
// GraphQL mutations. The parent lookup + relative-to lookup queries
|
|
70
|
+
// live in api/item-board-lookup.ts (R23 lift).
|
|
71
|
+
// ============================================================
|
|
72
|
+
const CREATE_ITEM_MUTATION = `
|
|
73
|
+
mutation ItemCreateTopLevel(
|
|
74
|
+
$boardId: ID!
|
|
75
|
+
$itemName: String!
|
|
76
|
+
$groupId: String
|
|
77
|
+
$columnValues: JSON
|
|
78
|
+
$createLabelsIfMissing: Boolean
|
|
79
|
+
$positionRelativeMethod: PositionRelative
|
|
80
|
+
$relativeTo: ID
|
|
81
|
+
) {
|
|
82
|
+
create_item(
|
|
83
|
+
board_id: $boardId
|
|
84
|
+
item_name: $itemName
|
|
85
|
+
group_id: $groupId
|
|
86
|
+
column_values: $columnValues
|
|
87
|
+
create_labels_if_missing: $createLabelsIfMissing
|
|
88
|
+
position_relative_method: $positionRelativeMethod
|
|
89
|
+
relative_to: $relativeTo
|
|
90
|
+
) {
|
|
91
|
+
id
|
|
92
|
+
name
|
|
93
|
+
board { id }
|
|
94
|
+
group { id }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
`;
|
|
98
|
+
const CREATE_SUBITEM_MUTATION = `
|
|
99
|
+
mutation ItemCreateSubitem(
|
|
100
|
+
$parentItemId: ID!
|
|
101
|
+
$itemName: String!
|
|
102
|
+
$columnValues: JSON
|
|
103
|
+
$createLabelsIfMissing: Boolean
|
|
104
|
+
) {
|
|
105
|
+
create_subitem(
|
|
106
|
+
parent_item_id: $parentItemId
|
|
107
|
+
item_name: $itemName
|
|
108
|
+
column_values: $columnValues
|
|
109
|
+
create_labels_if_missing: $createLabelsIfMissing
|
|
110
|
+
) {
|
|
111
|
+
id
|
|
112
|
+
name
|
|
113
|
+
board { id }
|
|
114
|
+
group { id }
|
|
115
|
+
parent_item { id }
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
`;
|
|
119
|
+
// ============================================================
|
|
120
|
+
// Wire response zod schemas (parse-boundary discipline, R18).
|
|
121
|
+
// ============================================================
|
|
122
|
+
// Per cli-design §6.4: data shape carries id, name, board_id,
|
|
123
|
+
// group_id (nullable when Monday returns no group — defensive,
|
|
124
|
+
// shouldn't happen in practice), parent_id (subitems only). The
|
|
125
|
+
// projector below maps Monday's nested response into this flat shape.
|
|
126
|
+
const itemCreateOutputSchema = z.object({
|
|
127
|
+
id: ItemIdSchema,
|
|
128
|
+
name: z.string(),
|
|
129
|
+
board_id: BoardIdSchema,
|
|
130
|
+
group_id: z.string().nullable(),
|
|
131
|
+
parent_id: ItemIdSchema.optional(),
|
|
132
|
+
});
|
|
133
|
+
const createItemResponseSchema = z
|
|
134
|
+
.object({
|
|
135
|
+
id: ItemIdSchema,
|
|
136
|
+
name: z.string(),
|
|
137
|
+
board: z.object({ id: BoardIdSchema }).nullable(),
|
|
138
|
+
group: z.object({ id: z.string() }).nullable(),
|
|
139
|
+
})
|
|
140
|
+
.loose();
|
|
141
|
+
const createSubitemResponseSchema = createItemResponseSchema.extend({
|
|
142
|
+
parent_item: z.object({ id: ItemIdSchema }).nullable(),
|
|
143
|
+
});
|
|
144
|
+
// ============================================================
|
|
145
|
+
// Input zod schema + dispatch.
|
|
146
|
+
// ============================================================
|
|
147
|
+
const positionEnum = z.enum(['before', 'after']);
|
|
148
|
+
const inputSchema = z
|
|
149
|
+
.object({
|
|
150
|
+
name: z.string().refine((s) => s.trim().length > 0, {
|
|
151
|
+
message: '--name must be non-empty (whitespace-only is rejected)',
|
|
152
|
+
}),
|
|
153
|
+
board: BoardIdSchema.optional(),
|
|
154
|
+
group: z.string().min(1).optional(),
|
|
155
|
+
set: z.array(z.string()).default([]),
|
|
156
|
+
setRaw: z.array(z.string()).default([]),
|
|
157
|
+
parent: ItemIdSchema.optional(),
|
|
158
|
+
position: positionEnum.optional(),
|
|
159
|
+
relativeTo: ItemIdSchema.optional(),
|
|
160
|
+
createLabelsIfMissing: z.boolean().optional(),
|
|
161
|
+
})
|
|
162
|
+
.strict();
|
|
163
|
+
/**
|
|
164
|
+
* Validates the cross-flag mutex / required-together rules per
|
|
165
|
+
* cli-design §4.3 line 519-528 and the §6.4 subitem variant. Throws
|
|
166
|
+
* `usage_error` with structured details so an agent can correct
|
|
167
|
+
* either flag without re-reading help text.
|
|
168
|
+
*/
|
|
169
|
+
const validateInputShape = (parsed) => {
|
|
170
|
+
const hasParent = parsed.parent !== undefined;
|
|
171
|
+
const hasGroup = parsed.group !== undefined;
|
|
172
|
+
const hasPosition = parsed.position !== undefined;
|
|
173
|
+
const hasRelativeTo = parsed.relativeTo !== undefined;
|
|
174
|
+
// --position and --relative-to are required together (one without
|
|
175
|
+
// the other → usage_error). Catch BEFORE the parent / position
|
|
176
|
+
// mutex so an agent passing `--parent --position` sees the
|
|
177
|
+
// pairing-incomplete error rather than the parent-mutex one.
|
|
178
|
+
if (hasPosition !== hasRelativeTo) {
|
|
179
|
+
throw new UsageError('--position and --relative-to are required together. ' +
|
|
180
|
+
'Pass both (e.g. `--position before --relative-to 99999`) ' +
|
|
181
|
+
'or neither.', {
|
|
182
|
+
details: {
|
|
183
|
+
...(parsed.position === undefined ? {} : { position: parsed.position }),
|
|
184
|
+
...(parsed.relativeTo === undefined
|
|
185
|
+
? {}
|
|
186
|
+
: { relative_to: parsed.relativeTo }),
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
if (hasParent) {
|
|
191
|
+
// --parent is mutex with --group, --position/--relative-to, and
|
|
192
|
+
// --board. Subitems live on Monday's auto-generated subitems
|
|
193
|
+
// board (not in groups, not relative to arbitrary items, not on
|
|
194
|
+
// a caller-named board) — accepting any of these would silently
|
|
195
|
+
// drop the value and create the subitem in the default location.
|
|
196
|
+
// Failing fast keeps the mental model clean.
|
|
197
|
+
if (hasGroup) {
|
|
198
|
+
throw new UsageError('--parent is mutually exclusive with --group. Subitems live ' +
|
|
199
|
+
'on Monday\'s auto-generated subitems board, not in groups; ' +
|
|
200
|
+
'drop --group or remove --parent.', { details: { parent: parsed.parent, group: parsed.group } });
|
|
201
|
+
}
|
|
202
|
+
if (hasPosition) {
|
|
203
|
+
throw new UsageError('--parent is mutually exclusive with --position / --relative-to. ' +
|
|
204
|
+
'Subitem position is parent-scoped, not relative to an arbitrary ' +
|
|
205
|
+
'item; drop --position / --relative-to or remove --parent.', {
|
|
206
|
+
details: {
|
|
207
|
+
parent: parsed.parent,
|
|
208
|
+
position: parsed.position,
|
|
209
|
+
relative_to: parsed.relativeTo,
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
if (parsed.board !== undefined) {
|
|
214
|
+
throw new UsageError('--parent is mutually exclusive with --board. The subitems board ' +
|
|
215
|
+
'is derived server-side from the parent; passing --board would ' +
|
|
216
|
+
'be ignored. Drop --board or remove --parent.', { details: { parent: parsed.parent, board: parsed.board } });
|
|
217
|
+
}
|
|
218
|
+
// hasParent === true ⇒ parsed.parent !== undefined (the
|
|
219
|
+
// discriminator at the top of validateInputShape). TypeScript
|
|
220
|
+
// doesn't narrow across the let-check pattern, so we capture
|
|
221
|
+
// a non-undefined local for the dispatch payload.
|
|
222
|
+
/* c8 ignore next 3 — defensive: hasParent fires only when the
|
|
223
|
+
parent slot is set; the throw is unreachable. */
|
|
224
|
+
if (parsed.parent === undefined) {
|
|
225
|
+
throw new UsageError('item create: parent narrowing failed');
|
|
226
|
+
}
|
|
227
|
+
return { kind: 'subitem', parentItemId: parsed.parent };
|
|
228
|
+
}
|
|
229
|
+
// Top-level path — --board is required.
|
|
230
|
+
if (parsed.board === undefined) {
|
|
231
|
+
throw new UsageError('--board <bid> is required for top-level item create. (Pass ' +
|
|
232
|
+
'--parent <iid> instead to create a subitem.)', { details: {} });
|
|
233
|
+
}
|
|
234
|
+
// Pre-flight: same-token duplicate in --set entries (resolution-
|
|
235
|
+
// free, fail-fast before any wire call). Cross-token duplicates
|
|
236
|
+
// and same-column-after-resolution dups surface in planCreate /
|
|
237
|
+
// the live three-pass resolver per cli-design §5.3 step 2.
|
|
238
|
+
// Same check is mirrored in subitem path (no early return).
|
|
239
|
+
// Implementation note: deferred the same-token check to a shared
|
|
240
|
+
// helper after dispatch returned to keep validateInputShape
|
|
241
|
+
// dispatch-only.
|
|
242
|
+
// Position narrowing: hasPosition && hasRelativeTo means both are
|
|
243
|
+
// defined (the `!==` undefined guards above) — capture into locals
|
|
244
|
+
// so TypeScript narrows away the `| undefined` slot rather than
|
|
245
|
+
// needing non-null assertions.
|
|
246
|
+
const position = parsed.position !== undefined && parsed.relativeTo !== undefined
|
|
247
|
+
? { method: parsed.position, relativeTo: parsed.relativeTo }
|
|
248
|
+
: undefined;
|
|
249
|
+
return {
|
|
250
|
+
kind: 'item',
|
|
251
|
+
boardId: parsed.board,
|
|
252
|
+
groupId: parsed.group,
|
|
253
|
+
position,
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
/**
|
|
257
|
+
* Pre-flight same-token check for `--set` and `--set-raw`. Catches
|
|
258
|
+
* the obvious case (`--set status=Done --set status=Doing`) without
|
|
259
|
+
* needing column resolution, so a malformed multi-`--set` fails
|
|
260
|
+
* before the network. The cross-token duplicate-resolved-id check
|
|
261
|
+
* still runs in planCreate / the live path (per cli-design §5.3 step
|
|
262
|
+
* 2 — the contract is resolution-time, but the pre-flight catches
|
|
263
|
+
* the easy half cheap).
|
|
264
|
+
*/
|
|
265
|
+
const checkDuplicateTokens = (setEntries, rawEntries) => {
|
|
266
|
+
const seen = new Set();
|
|
267
|
+
for (const e of [...setEntries, ...rawEntries]) {
|
|
268
|
+
if (seen.has(e.token)) {
|
|
269
|
+
throw new UsageError(`Multiple --set / --set-raw entries target column token ` +
|
|
270
|
+
`${JSON.stringify(e.token)}. Pass at most one per column; if two ` +
|
|
271
|
+
`tokens resolve to the same column ID after NFC + case-fold ` +
|
|
272
|
+
`normalisation, use the \`id:<column_id>\` prefix to disambiguate.`, { details: { token: e.token } });
|
|
273
|
+
}
|
|
274
|
+
seen.add(e.token);
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
// ============================================================
|
|
278
|
+
// Subitem-path helpers.
|
|
279
|
+
// ============================================================
|
|
280
|
+
/**
|
|
281
|
+
* Looks up the parent item's board id + `hierarchy_type` so the
|
|
282
|
+
* multi-level gate can fire pre-mutation. Wraps the shared
|
|
283
|
+
* `lookupItemBoardWithHierarchy` helper with the parent-item label
|
|
284
|
+
* + detail key.
|
|
285
|
+
*/
|
|
286
|
+
const lookupParent = async (client, parentItemId) => {
|
|
287
|
+
const result = await lookupItemBoardWithHierarchy({
|
|
288
|
+
client,
|
|
289
|
+
itemId: parentItemId,
|
|
290
|
+
label: 'Parent item',
|
|
291
|
+
detailKey: 'parent_item_id',
|
|
292
|
+
});
|
|
293
|
+
return {
|
|
294
|
+
boardId: result.boardId,
|
|
295
|
+
hierarchyType: result.hierarchyType,
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* Derives the auto-generated subitems board ID from the parent
|
|
300
|
+
* board's `subtasks` column. Monday's classic-board model exposes
|
|
301
|
+
* the subitems board through the `subtasks` column's
|
|
302
|
+
* `settings_str.boardIds[0]`. When the column is missing or the
|
|
303
|
+
* settings are empty / malformed, the CLI surfaces `usage_error` —
|
|
304
|
+
* the parent's board doesn't have a subitems lane provisioned, so
|
|
305
|
+
* Monday's server-side `create_subitem` would either fail or auto-
|
|
306
|
+
* provision in a way the CLI can't predict for column resolution.
|
|
307
|
+
*
|
|
308
|
+
* The agent's recovery path: drop `--set` / `--set-raw` (subitem
|
|
309
|
+
* still creates without column resolution) or use `--set-raw` on
|
|
310
|
+
* a `id:<col_id>` token (still requires resolution; the same gate
|
|
311
|
+
* fires).
|
|
312
|
+
*/
|
|
313
|
+
const deriveSubitemsBoardId = (parentMetadata, parentItemId, parentBoardId) => {
|
|
314
|
+
const subtasksColumn = parentMetadata.columns.find((c) => c.type === 'subtasks');
|
|
315
|
+
if (subtasksColumn === undefined) {
|
|
316
|
+
throw new UsageError(`Parent board ${parentBoardId} has no subtasks column; the subitems ` +
|
|
317
|
+
`board for column resolution can't be derived. Either remove --set ` +
|
|
318
|
+
`/ --set-raw (subitem still creates without column resolution), or ` +
|
|
319
|
+
`add a subitems column to the parent's board first.`, {
|
|
320
|
+
details: {
|
|
321
|
+
parent_item_id: parentItemId,
|
|
322
|
+
parent_board_id: parentBoardId,
|
|
323
|
+
},
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
if (subtasksColumn.settings_str === null) {
|
|
327
|
+
throw new UsageError(`Parent board ${parentBoardId}'s subtasks column has no settings; ` +
|
|
328
|
+
`the subitems board ID can't be derived. Either remove --set / ` +
|
|
329
|
+
`--set-raw (subitem still creates without column resolution), or ` +
|
|
330
|
+
`re-run after the parent has at least one existing subitem so ` +
|
|
331
|
+
`Monday provisions the subitems board.`, {
|
|
332
|
+
details: {
|
|
333
|
+
parent_item_id: parentItemId,
|
|
334
|
+
parent_board_id: parentBoardId,
|
|
335
|
+
subtasks_column_id: subtasksColumn.id,
|
|
336
|
+
},
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
let parsed;
|
|
340
|
+
try {
|
|
341
|
+
parsed = JSON.parse(subtasksColumn.settings_str);
|
|
342
|
+
}
|
|
343
|
+
catch {
|
|
344
|
+
parsed = null;
|
|
345
|
+
}
|
|
346
|
+
const boardIds = parsed !== null &&
|
|
347
|
+
typeof parsed === 'object' &&
|
|
348
|
+
!Array.isArray(parsed) &&
|
|
349
|
+
Array.isArray(parsed.boardIds)
|
|
350
|
+
? parsed.boardIds.filter((id) => typeof id === 'string')
|
|
351
|
+
: [];
|
|
352
|
+
const subitemsBoardId = boardIds[0];
|
|
353
|
+
if (subitemsBoardId === undefined) {
|
|
354
|
+
throw new UsageError(`Parent board ${parentBoardId}'s subtasks column has no linked ` +
|
|
355
|
+
`subitems board yet; create one subitem on the parent first (which ` +
|
|
356
|
+
`provisions the subitems board) and re-run, or drop --set / ` +
|
|
357
|
+
`--set-raw on this call.`, {
|
|
358
|
+
details: {
|
|
359
|
+
parent_item_id: parentItemId,
|
|
360
|
+
parent_board_id: parentBoardId,
|
|
361
|
+
subtasks_column_id: subtasksColumn.id,
|
|
362
|
+
},
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
return subitemsBoardId;
|
|
366
|
+
};
|
|
367
|
+
/**
|
|
368
|
+
* Verifies a `--relative-to` item lives on the same board as the
|
|
369
|
+
* top-level create's `--board <bid>`. Mirrors the M5b wrong-board
|
|
370
|
+
* check (`item set` / `item update`) shape — surfaces `usage_error`
|
|
371
|
+
* with `requested_board_id` + `item_board_id` in details so the
|
|
372
|
+
* agent can self-correct.
|
|
373
|
+
*/
|
|
374
|
+
const verifyRelativeToOnBoard = async (client, relativeToId, boardId) => {
|
|
375
|
+
const result = await lookupItemBoard({
|
|
376
|
+
client,
|
|
377
|
+
itemId: relativeToId,
|
|
378
|
+
label: '--relative-to item',
|
|
379
|
+
detailKey: 'relative_to_id',
|
|
380
|
+
});
|
|
381
|
+
if (result.boardId !== boardId) {
|
|
382
|
+
throw new UsageError(`--relative-to item ${relativeToId} lives on board ${result.boardId}, ` +
|
|
383
|
+
`but --board is ${boardId}. Pass a --relative-to item on the same ` +
|
|
384
|
+
`board, or drop --position / --relative-to.`, {
|
|
385
|
+
details: {
|
|
386
|
+
relative_to_id: relativeToId,
|
|
387
|
+
item_board_id: result.boardId,
|
|
388
|
+
requested_board_id: boardId,
|
|
389
|
+
},
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
/**
|
|
394
|
+
* Builds the `CreateMode` (dry-run engine + live path consume the
|
|
395
|
+
* same shape) from the dispatch result. Three orchestration steps
|
|
396
|
+
* for the subitem path:
|
|
397
|
+
*
|
|
398
|
+
* 1. Look up parent item → get parent's board id + `hierarchy_type`.
|
|
399
|
+
* 2. Reject `multi_level` boards (M9 supports classic only).
|
|
400
|
+
* 3. If `--set` / `--set-raw` is present, load parent's BoardMetadata
|
|
401
|
+
* → find `subtasks` column → derive subitems-board id from
|
|
402
|
+
* `settings_str.boardIds[0]`.
|
|
403
|
+
*
|
|
404
|
+
* For top-level: verifies the `--relative-to` item lives on `--board`
|
|
405
|
+
* when `--position` is set (mirrors M5b's wrong-board check).
|
|
406
|
+
*
|
|
407
|
+
* Pure orchestrator — no side-effects beyond the network calls and
|
|
408
|
+
* the cache writes inside `loadBoardMetadata`. Throws typed errors
|
|
409
|
+
* (`usage_error` / `not_found`) per the cli-design §6.5 surface.
|
|
410
|
+
*/
|
|
411
|
+
const resolveCreateMode = async (inputs) => {
|
|
412
|
+
const { client, dispatch, setEntries, rawEntries, env, noCache } = inputs;
|
|
413
|
+
if (dispatch.kind === 'subitem') {
|
|
414
|
+
// Parent lookup is always live (no item-level cache in v0.2).
|
|
415
|
+
const parent = await lookupParent(client, dispatch.parentItemId);
|
|
416
|
+
if (parent.hierarchyType === 'multi_level') {
|
|
417
|
+
throw new UsageError(`Parent item ${dispatch.parentItemId} lives on a multi-level ` +
|
|
418
|
+
`board (hierarchy_type "multi_level"); subitem creation on ` +
|
|
419
|
+
`multi-level boards is deferred to v0.3. Use a classic ` +
|
|
420
|
+
`board (hierarchy_type null/"classic") or wait for v0.3.`, {
|
|
421
|
+
details: {
|
|
422
|
+
parent_item_id: dispatch.parentItemId,
|
|
423
|
+
parent_board_id: parent.boardId,
|
|
424
|
+
hierarchy_type: parent.hierarchyType,
|
|
425
|
+
deferred_to: 'v0.3',
|
|
426
|
+
},
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
if (setEntries.length > 0 || rawEntries.length > 0) {
|
|
430
|
+
const parentMetadata = await loadBoardMetadata({
|
|
431
|
+
client,
|
|
432
|
+
boardId: parent.boardId,
|
|
433
|
+
env,
|
|
434
|
+
noCache,
|
|
435
|
+
});
|
|
436
|
+
const subitemsBoardId = deriveSubitemsBoardId(parentMetadata.metadata, dispatch.parentItemId, parent.boardId);
|
|
437
|
+
// Parent lookup is always live; parent metadata may be cache
|
|
438
|
+
// or live. Merge the two so the final envelope reflects both
|
|
439
|
+
// pre-planner legs (Codex M9 P2 #1). The 'cache' branch fires
|
|
440
|
+
// when the metadata cache is pre-warmed by a prior call within
|
|
441
|
+
// the TTL window — covered by item set / item update tests for
|
|
442
|
+
// the broader cache plumbing; M9 inherits the tested helper
|
|
443
|
+
// and pins the non-cache branch via the integration tests.
|
|
444
|
+
/* c8 ignore next 2 — cache pre-warming for the parent-board
|
|
445
|
+
metadata leg needs a multi-call XDG_CACHE_HOME setup that's
|
|
446
|
+
covered for the same `loadBoardMetadata` helper in item set
|
|
447
|
+
/ item update tests; M9 inherits the helper's coverage. */
|
|
448
|
+
const parentSource = parentMetadata.source === 'cache' ? 'mixed' : 'live';
|
|
449
|
+
return {
|
|
450
|
+
mode: {
|
|
451
|
+
kind: 'subitem',
|
|
452
|
+
parentItemId: dispatch.parentItemId,
|
|
453
|
+
subitemsBoardId,
|
|
454
|
+
},
|
|
455
|
+
preflightSource: parentSource,
|
|
456
|
+
preflightCacheAgeSeconds: parentMetadata.cacheAgeSeconds,
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
// No --set / --set-raw → no column resolution needed. Reuse
|
|
460
|
+
// parent's board id as the placeholder (subitemsBoardId is
|
|
461
|
+
// unused when both arrays are empty per planCreate's no-set
|
|
462
|
+
// short-circuit and the live path's resolution loop).
|
|
463
|
+
// Parent lookup was live; no metadata leg fired.
|
|
464
|
+
return {
|
|
465
|
+
mode: {
|
|
466
|
+
kind: 'subitem',
|
|
467
|
+
parentItemId: dispatch.parentItemId,
|
|
468
|
+
subitemsBoardId: parent.boardId,
|
|
469
|
+
},
|
|
470
|
+
preflightSource: 'live',
|
|
471
|
+
preflightCacheAgeSeconds: null,
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
// top-level
|
|
475
|
+
if (dispatch.position !== undefined) {
|
|
476
|
+
await verifyRelativeToOnBoard(client, dispatch.position.relativeTo, dispatch.boardId);
|
|
477
|
+
return {
|
|
478
|
+
mode: {
|
|
479
|
+
kind: 'item',
|
|
480
|
+
boardId: dispatch.boardId,
|
|
481
|
+
...(dispatch.groupId === undefined ? {} : { groupId: dispatch.groupId }),
|
|
482
|
+
position: dispatch.position,
|
|
483
|
+
},
|
|
484
|
+
// --relative-to verification is always live; no cache leg.
|
|
485
|
+
preflightSource: 'live',
|
|
486
|
+
preflightCacheAgeSeconds: null,
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
return {
|
|
490
|
+
mode: {
|
|
491
|
+
kind: 'item',
|
|
492
|
+
boardId: dispatch.boardId,
|
|
493
|
+
...(dispatch.groupId === undefined ? {} : { groupId: dispatch.groupId }),
|
|
494
|
+
},
|
|
495
|
+
// No pre-planner network leg.
|
|
496
|
+
preflightSource: undefined,
|
|
497
|
+
preflightCacheAgeSeconds: null,
|
|
498
|
+
};
|
|
499
|
+
};
|
|
500
|
+
// ============================================================
|
|
501
|
+
// Main command export.
|
|
502
|
+
// ============================================================
|
|
503
|
+
export const itemCreateCommand = {
|
|
504
|
+
name: 'item.create',
|
|
505
|
+
summary: 'Create a new item or subitem',
|
|
506
|
+
examples: [
|
|
507
|
+
'monday item create --board 67890 --name "Refactor login"',
|
|
508
|
+
'monday item create --board 67890 --name "Refactor login" --group topics',
|
|
509
|
+
'monday item create --board 67890 --name "Refactor login" --set status=Done',
|
|
510
|
+
'monday item create --board 67890 --name "Refactor login" --set status=Done --set due=+1w',
|
|
511
|
+
'monday item create --board 67890 --name "Refactor login" --position before --relative-to 99999',
|
|
512
|
+
'monday item create --parent 12345 --name "Subtask 1"',
|
|
513
|
+
'monday item create --parent 12345 --name "Subtask 1" --set status=Working',
|
|
514
|
+
'monday item create --board 67890 --name "Refactor login" --dry-run --json',
|
|
515
|
+
],
|
|
516
|
+
// Re-running creates a duplicate item; agents needing idempotent
|
|
517
|
+
// create-or-update use `monday item upsert` (M12).
|
|
518
|
+
idempotent: false,
|
|
519
|
+
inputSchema,
|
|
520
|
+
outputSchema: itemCreateOutputSchema,
|
|
521
|
+
attach: (program, ctx) => {
|
|
522
|
+
const noun = ensureSubcommand(program, 'item', 'Item commands');
|
|
523
|
+
noun
|
|
524
|
+
.command('create')
|
|
525
|
+
.description(itemCreateCommand.summary)
|
|
526
|
+
.requiredOption('--name <n>', 'item name (required, non-empty)')
|
|
527
|
+
.option('--board <bid>', 'board ID (required for top-level; rejected with --parent)')
|
|
528
|
+
.option('--group <gid>', 'group ID (top-level only; default = board\'s default group)')
|
|
529
|
+
.option('--set <expr>', 'repeatable <col>=<val> column write (bundled into create_item.column_values)', (value, prev) => [...prev, value], [])
|
|
530
|
+
.option('--set-raw <expr>', 'repeatable <col>=<json> raw write (escape hatch — bypasses friendly translator)', (value, prev) => [...prev, value], [])
|
|
531
|
+
.option('--parent <iid>', 'create as subitem of this parent item ID')
|
|
532
|
+
.option('--position <method>', 'item placement: "before" | "after" (requires --relative-to)')
|
|
533
|
+
.option('--relative-to <iid>', 'item ID for --position; must be on the same board')
|
|
534
|
+
.option('--create-labels-if-missing', 'auto-create unknown status / dropdown labels (Monday flag)')
|
|
535
|
+
.addHelpText('after', ['', 'Examples:', ...itemCreateCommand.examples.map((e) => ` ${e}`), ''].join('\n'))
|
|
536
|
+
.action(async (opts) => {
|
|
537
|
+
const parsed = parseArgv(itemCreateCommand.inputSchema, {
|
|
538
|
+
...opts,
|
|
539
|
+
});
|
|
540
|
+
const { client, globalFlags, apiVersion, toEmit } = resolveClient(ctx, program.opts());
|
|
541
|
+
const dispatch = validateInputShape(parsed);
|
|
542
|
+
// Argv-parse-time failures fire BEFORE any network call —
|
|
543
|
+
// splits run on pure strings, JSON parse on `--set-raw` runs
|
|
544
|
+
// on pure strings. Mirrors the M8 `item update` finding (#4):
|
|
545
|
+
// a malformed `--set-raw` shouldn't pay for a parent / board
|
|
546
|
+
// / metadata round-trip first.
|
|
547
|
+
const setEntries = parsed.set.map(splitSetExpression);
|
|
548
|
+
const rawEntries = parsed.setRaw.map(parseSetRawExpression);
|
|
549
|
+
checkDuplicateTokens(setEntries, rawEntries);
|
|
550
|
+
// Resolve the create context: a single `createMode` that
|
|
551
|
+
// both the dry-run engine and the live mutation consume. For
|
|
552
|
+
// top-level, it's the verified `--board` plus optional
|
|
553
|
+
// group / position. For subitem, it's the parent item id +
|
|
554
|
+
// the derived subitems-board id (used for column resolution).
|
|
555
|
+
// Building it once avoids a let-assignment pattern that
|
|
556
|
+
// forced non-null assertions later.
|
|
557
|
+
//
|
|
558
|
+
// The result also carries `preflightSource` /
|
|
559
|
+
// `preflightCacheAgeSeconds` for the parent-lookup +
|
|
560
|
+
// parent-metadata + relative-to-verification legs that fire
|
|
561
|
+
// before planCreate / live mutation (Codex M9 P2 #1). These
|
|
562
|
+
// fold into the final envelope source so a `meta.source`
|
|
563
|
+
// claim never lies about a network leg that fired.
|
|
564
|
+
const createModeResult = await resolveCreateMode({
|
|
565
|
+
client,
|
|
566
|
+
dispatch,
|
|
567
|
+
setEntries,
|
|
568
|
+
rawEntries,
|
|
569
|
+
env: ctx.env,
|
|
570
|
+
noCache: globalFlags.noCache,
|
|
571
|
+
});
|
|
572
|
+
const createMode = createModeResult.mode;
|
|
573
|
+
const resolveBoardId = createMode.kind === 'subitem'
|
|
574
|
+
? createMode.subitemsBoardId
|
|
575
|
+
: createMode.boardId;
|
|
576
|
+
const { dateResolution, peopleResolution } = buildResolutionContexts({ client, ctx, globalFlags });
|
|
577
|
+
if (globalFlags.dryRun) {
|
|
578
|
+
const result = await planCreate({
|
|
579
|
+
client,
|
|
580
|
+
mode: createMode,
|
|
581
|
+
name: parsed.name,
|
|
582
|
+
setEntries,
|
|
583
|
+
...(rawEntries.length === 0 ? {} : { rawEntries }),
|
|
584
|
+
dateResolution,
|
|
585
|
+
peopleResolution,
|
|
586
|
+
env: ctx.env,
|
|
587
|
+
noCache: globalFlags.noCache,
|
|
588
|
+
});
|
|
589
|
+
// Dry-run envelope source folds three legs (Codex M9 P2 #1):
|
|
590
|
+
// pre-planner network calls (parent lookup + parent-board
|
|
591
|
+
// metadata + --relative-to verification) + planCreate's
|
|
592
|
+
// column-resolution legs. `meta.source: "none"` is only
|
|
593
|
+
// accurate when ZERO wire calls fired.
|
|
594
|
+
const dryRunSource = mergeSourceWithPreflight(result.source, createModeResult.preflightSource);
|
|
595
|
+
const dryRunCacheAge = mergeCacheAge(result.cacheAgeSeconds, createModeResult.preflightCacheAgeSeconds);
|
|
596
|
+
emitDryRun({
|
|
597
|
+
ctx,
|
|
598
|
+
programOpts: program.opts(),
|
|
599
|
+
plannedChanges: result.plannedChanges,
|
|
600
|
+
source: dryRunSource,
|
|
601
|
+
cacheAgeSeconds: dryRunCacheAge,
|
|
602
|
+
warnings: result.warnings,
|
|
603
|
+
apiVersion,
|
|
604
|
+
});
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
// Live create path. Three-pass resolution + translation
|
|
608
|
+
// through the shared helper (R20 lift), then bundle into one
|
|
609
|
+
// column_values map and fire the single-round-trip mutation
|
|
610
|
+
// per cli-design §5.8.
|
|
611
|
+
const resolutionResult = await resolveAndTranslate({
|
|
612
|
+
client,
|
|
613
|
+
boardId: resolveBoardId,
|
|
614
|
+
setEntries,
|
|
615
|
+
rawEntries,
|
|
616
|
+
dateResolution,
|
|
617
|
+
peopleResolution,
|
|
618
|
+
env: ctx.env,
|
|
619
|
+
noCache: globalFlags.noCache,
|
|
620
|
+
});
|
|
621
|
+
const collectedWarnings = [
|
|
622
|
+
...resolutionResult.warnings,
|
|
623
|
+
];
|
|
624
|
+
const resolvedIds = resolutionResult.resolvedIds;
|
|
625
|
+
// Live envelope source aggregates four legs (Codex M9 P2 #1):
|
|
626
|
+
// pre-planner network calls (parent lookup + parent metadata
|
|
627
|
+
// + relative-to verification) → column resolution legs →
|
|
628
|
+
// mutation (always live). Dry-run path stays on the
|
|
629
|
+
// standalone `mergeSourceWithPreflight` helper because the
|
|
630
|
+
// planner there can claim 'none' (no wire call); the class
|
|
631
|
+
// shape only handles `EnvelopeSource = 'live'|'cache'|'mixed'`.
|
|
632
|
+
const sourceAgg = new SourceAggregator();
|
|
633
|
+
if (resolutionResult.source !== undefined) {
|
|
634
|
+
sourceAgg.record(resolutionResult.source, resolutionResult.cacheAgeSeconds);
|
|
635
|
+
}
|
|
636
|
+
if (createModeResult.preflightSource !== undefined) {
|
|
637
|
+
sourceAgg.record(createModeResult.preflightSource, createModeResult.preflightCacheAgeSeconds);
|
|
638
|
+
}
|
|
639
|
+
const translated = resolutionResult.translated;
|
|
640
|
+
// Bundle into the column_values map (single-round-trip per
|
|
641
|
+
// cli-design §5.8). When zero translated values, send `null`
|
|
642
|
+
// so Monday's create accepts "no column values" rather than
|
|
643
|
+
// an empty map (semantically distinct on Monday's wire).
|
|
644
|
+
const columnValues = translated.length === 0 ? null : bundleColumnValues(translated);
|
|
645
|
+
let mutationResult;
|
|
646
|
+
try {
|
|
647
|
+
if (createMode.kind === 'subitem') {
|
|
648
|
+
mutationResult = await executeCreateSubitem(client, {
|
|
649
|
+
parentItemId: createMode.parentItemId,
|
|
650
|
+
itemName: parsed.name,
|
|
651
|
+
columnValues,
|
|
652
|
+
createLabelsIfMissing: parsed.createLabelsIfMissing,
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
else {
|
|
656
|
+
mutationResult = await executeCreateItem(client, {
|
|
657
|
+
boardId: createMode.boardId,
|
|
658
|
+
itemName: parsed.name,
|
|
659
|
+
groupId: createMode.groupId,
|
|
660
|
+
position: createMode.position,
|
|
661
|
+
columnValues,
|
|
662
|
+
createLabelsIfMissing: parsed.createLabelsIfMissing,
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
catch (err) {
|
|
667
|
+
if (err instanceof MondayCliError) {
|
|
668
|
+
// F4 remap: cache-sourced resolution + Monday rejecting
|
|
669
|
+
// as validation_failed → check live archived state.
|
|
670
|
+
// Codex M9 P1: pre-fix the create path skipped this
|
|
671
|
+
// catch arm on the assumption that the explicit archived
|
|
672
|
+
// gate above (`includeArchived: true` + throw) covered
|
|
673
|
+
// every case. It doesn't — cache can say "active" after
|
|
674
|
+
// Monday archived the column post-cache-write. Pass
|
|
675
|
+
// every translated column ID (M5b finding #3) so
|
|
676
|
+
// multi-`--set` cases where a later target is archived
|
|
677
|
+
// still remap.
|
|
678
|
+
throw await foldAndRemap({
|
|
679
|
+
err,
|
|
680
|
+
warnings: collectedWarnings,
|
|
681
|
+
client,
|
|
682
|
+
boardId: resolveBoardId,
|
|
683
|
+
columnIds: translated.map((t) => t.columnId),
|
|
684
|
+
env: ctx.env,
|
|
685
|
+
noCache: globalFlags.noCache,
|
|
686
|
+
resolutionSource: resolutionResult.source ?? 'live',
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
throw err;
|
|
690
|
+
}
|
|
691
|
+
const warnings = collectedWarnings;
|
|
692
|
+
// Mutation leg fires live; record it so the aggregate
|
|
693
|
+
// collapses cache-served resolution / preflight legs to
|
|
694
|
+
// `mixed`. Live path never sees a 'none' source (the
|
|
695
|
+
// mutation always fires) so the class's `EnvelopeSource`
|
|
696
|
+
// shape suffices.
|
|
697
|
+
sourceAgg.record('live', null);
|
|
698
|
+
emitMutation({
|
|
699
|
+
ctx,
|
|
700
|
+
data: mutationResult.projected,
|
|
701
|
+
schema: itemCreateCommand.outputSchema,
|
|
702
|
+
programOpts: program.opts(),
|
|
703
|
+
warnings,
|
|
704
|
+
...toEmit(mutationResult.response),
|
|
705
|
+
...sourceAgg.result(),
|
|
706
|
+
// cli-design §5.3 step 2 / §6.4: echo the resolved column
|
|
707
|
+
// IDs so an agent's "create then re-read" loop can use the
|
|
708
|
+
// resolved IDs without consulting metadata twice. Empty map
|
|
709
|
+
// when no `--set` / `--set-raw` was passed (mirrors item
|
|
710
|
+
// update with no resolved columns).
|
|
711
|
+
resolvedIds,
|
|
712
|
+
});
|
|
713
|
+
});
|
|
714
|
+
},
|
|
715
|
+
};
|
|
716
|
+
const executeCreateItem = async (client, inputs) => {
|
|
717
|
+
const variables = {
|
|
718
|
+
boardId: inputs.boardId,
|
|
719
|
+
itemName: inputs.itemName,
|
|
720
|
+
groupId: inputs.groupId ?? null,
|
|
721
|
+
columnValues: inputs.columnValues,
|
|
722
|
+
createLabelsIfMissing: inputs.createLabelsIfMissing ?? false,
|
|
723
|
+
};
|
|
724
|
+
if (inputs.position !== undefined) {
|
|
725
|
+
// Monday's PositionRelative enum string values are `before_at` /
|
|
726
|
+
// `after_at`; the CLI surfaces friendlier `before` / `after` per
|
|
727
|
+
// cli-design §4.3, mapped here at the wire boundary.
|
|
728
|
+
variables.positionRelativeMethod =
|
|
729
|
+
inputs.position.method === 'before' ? 'before_at' : 'after_at';
|
|
730
|
+
variables.relativeTo = inputs.position.relativeTo;
|
|
731
|
+
}
|
|
732
|
+
else {
|
|
733
|
+
variables.positionRelativeMethod = null;
|
|
734
|
+
variables.relativeTo = null;
|
|
735
|
+
}
|
|
736
|
+
const response = await client.raw(CREATE_ITEM_MUTATION, variables, { operationName: 'ItemCreateTopLevel' });
|
|
737
|
+
if (response.data.create_item === null || response.data.create_item === undefined) {
|
|
738
|
+
throw new ApiError('internal_error', `Monday returned no item payload from create_item.`, { details: { board_id: inputs.boardId, item_name: inputs.itemName } });
|
|
739
|
+
}
|
|
740
|
+
const parsed = unwrapOrThrow(createItemResponseSchema.safeParse(response.data.create_item), {
|
|
741
|
+
context: 'Monday returned a malformed create_item response',
|
|
742
|
+
details: { board_id: inputs.boardId },
|
|
743
|
+
});
|
|
744
|
+
// Defensive: Monday's create_item always returns a board { id } per
|
|
745
|
+
// its schema, but the response schema admits null to keep the parse
|
|
746
|
+
// boundary tolerant of API drift. Fall back to the requested board
|
|
747
|
+
// id (re-parsed through BoardIdSchema to satisfy the brand) so the
|
|
748
|
+
// projected envelope keeps a non-null board_id even on the rare
|
|
749
|
+
// null-board response path.
|
|
750
|
+
return {
|
|
751
|
+
projected: {
|
|
752
|
+
id: parsed.id,
|
|
753
|
+
name: parsed.name,
|
|
754
|
+
board_id: parsed.board?.id ?? BoardIdSchema.parse(inputs.boardId),
|
|
755
|
+
group_id: parsed.group?.id ?? null,
|
|
756
|
+
},
|
|
757
|
+
response,
|
|
758
|
+
};
|
|
759
|
+
};
|
|
760
|
+
const executeCreateSubitem = async (client, inputs) => {
|
|
761
|
+
const response = await client.raw(CREATE_SUBITEM_MUTATION, {
|
|
762
|
+
parentItemId: inputs.parentItemId,
|
|
763
|
+
itemName: inputs.itemName,
|
|
764
|
+
columnValues: inputs.columnValues,
|
|
765
|
+
createLabelsIfMissing: inputs.createLabelsIfMissing ?? false,
|
|
766
|
+
}, { operationName: 'ItemCreateSubitem' });
|
|
767
|
+
if (response.data.create_subitem === null ||
|
|
768
|
+
response.data.create_subitem === undefined) {
|
|
769
|
+
throw new ApiError('internal_error', `Monday returned no item payload from create_subitem.`, {
|
|
770
|
+
details: {
|
|
771
|
+
parent_item_id: inputs.parentItemId,
|
|
772
|
+
item_name: inputs.itemName,
|
|
773
|
+
},
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
const parsed = unwrapOrThrow(createSubitemResponseSchema.safeParse(response.data.create_subitem), {
|
|
777
|
+
context: 'Monday returned a malformed create_subitem response',
|
|
778
|
+
details: { parent_item_id: inputs.parentItemId },
|
|
779
|
+
});
|
|
780
|
+
if (parsed.board === null) {
|
|
781
|
+
throw new ApiError('internal_error', `Monday returned no board for the new subitem.`, { details: { parent_item_id: inputs.parentItemId } });
|
|
782
|
+
}
|
|
783
|
+
// Always populate `parent_id` from argv — the CLI knows the
|
|
784
|
+
// parent ID it just sent on the wire, so omitting it when Monday
|
|
785
|
+
// returns `parent_item: null` would create a documented-shape
|
|
786
|
+
// drift (output-shapes.md subitem section pins parent_id as
|
|
787
|
+
// present). Codex M9 P2 #3.
|
|
788
|
+
return {
|
|
789
|
+
projected: {
|
|
790
|
+
id: parsed.id,
|
|
791
|
+
name: parsed.name,
|
|
792
|
+
board_id: parsed.board.id,
|
|
793
|
+
group_id: parsed.group?.id ?? null,
|
|
794
|
+
// Re-parse through ItemIdSchema to satisfy the brand;
|
|
795
|
+
// `inputs.parentItemId` is plain `string` from the input
|
|
796
|
+
// shape but this slot needs the branded type.
|
|
797
|
+
parent_id: ItemIdSchema.parse(inputs.parentItemId),
|
|
798
|
+
},
|
|
799
|
+
response,
|
|
800
|
+
};
|
|
801
|
+
};
|
|
802
|
+
//# sourceMappingURL=create.js.map
|