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,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor-based pagination walker (`cli-design.md` §2.4 / §5.6,
|
|
3
|
+
* `v0.1-plan.md` §3 M4).
|
|
4
|
+
*
|
|
5
|
+
* The cursor walker is fundamentally different from `walk-pages.ts`'s
|
|
6
|
+
* page-based shape: Monday issues a 60-minute cursor on the *initial*
|
|
7
|
+
* `items_page` call and a stale cursor returns
|
|
8
|
+
* `INVALID_CURSOR_EXCEPTION` (mapped to `stale_cursor` by
|
|
9
|
+
* `api/errors.ts`). The §5.6 contract is **fail-fast on expiry —
|
|
10
|
+
* never silently re-issue the initial query**, because a re-issue
|
|
11
|
+
* between page N and the resumed walk can duplicate or skip items
|
|
12
|
+
* (board mutated, item archived, etc.). That's silent corruption;
|
|
13
|
+
* the design rejects it explicitly.
|
|
14
|
+
*
|
|
15
|
+
* **Result-type discipline (§14 M3 lesson, prophylactic adoption).**
|
|
16
|
+
* `PaginationWalkResult` carries every §6.1 + §6.3 meta slot from
|
|
17
|
+
* day one — `source`, `cacheAgeSeconds`, `complexity`, `warnings`,
|
|
18
|
+
* `nextCursor`, `hasMore`, `totalReturned`. M3's
|
|
19
|
+
* `BoardMetadataLoadResult` and `ResolveColumnWithRefreshResult`
|
|
20
|
+
* both under-budgeted their meta surface and grew during review;
|
|
21
|
+
* M4 starts complete. Cursor-paginated reads always run live
|
|
22
|
+
* (`source: 'live'`, `cacheAgeSeconds: null`) — the fields are
|
|
23
|
+
* present anyway so callers spread them without thinking about the
|
|
24
|
+
* branch.
|
|
25
|
+
*
|
|
26
|
+
* **Streaming hook (`onItem`).** Required for `item list --output
|
|
27
|
+
* ndjson` per §6.3 — items emit per-arrival, not after the whole
|
|
28
|
+
* walk collects. The walker calls `onItem` once per item *in
|
|
29
|
+
* per-page-sorted order* (the sort-by-ID pass per §3.1 #8 happens
|
|
30
|
+
* before the callback fires), then the trailer (the §6.3 `_meta`
|
|
31
|
+
* line) carries `next_cursor` / `has_more` / `total_returned`. If
|
|
32
|
+
* a stale cursor fires mid-walk, `onItem` has already emitted the
|
|
33
|
+
* pre-failure items; the caller produces the error envelope on
|
|
34
|
+
* stderr as documented in §6.3 / §6.5.
|
|
35
|
+
*
|
|
36
|
+
* **Cursor lifetime tracking.** The walker reads `now: () => Date`
|
|
37
|
+
* from inputs — production wires `ctx.clock`, tests inject a
|
|
38
|
+
* deterministic clock. The age is measured from the `now()` value
|
|
39
|
+
* captured *before* the initial request fires (so the test clock
|
|
40
|
+
* controls expiry deterministically; no wall-clock waits). On a
|
|
41
|
+
* mid-walk `stale_cursor` from Monday, the walker enriches the
|
|
42
|
+
* error's `details` with `cursor_age_seconds` /
|
|
43
|
+
* `items_returned_so_far` / `last_item_id` per §5.6.
|
|
44
|
+
*/
|
|
45
|
+
import type { MondayResponse } from './client.js';
|
|
46
|
+
import type { Complexity, Warning } from '../utils/output/envelope.js';
|
|
47
|
+
/**
|
|
48
|
+
* Monday's cursor lifetime per `cli-design.md` §2.4 / §5.6.
|
|
49
|
+
* Exported so a `--cursor-lifetime-seconds` flag (if ever added)
|
|
50
|
+
* can shadow it; for v0.1 it's a constant.
|
|
51
|
+
*/
|
|
52
|
+
export declare const CURSOR_LIFETIME_SECONDS: number;
|
|
53
|
+
/**
|
|
54
|
+
* Default page size — Monday caps at 500 (§2.4). Most agent queries
|
|
55
|
+
* fit well under this; the walker's caller can override via
|
|
56
|
+
* `pageSize` to reduce per-request payload size when items carry a
|
|
57
|
+
* lot of column-value data.
|
|
58
|
+
*/
|
|
59
|
+
export declare const DEFAULT_PAGE_SIZE = 100;
|
|
60
|
+
/**
|
|
61
|
+
* One page response from either `items_page` (initial) or
|
|
62
|
+
* `next_items_page` (subsequent). Caller's projector returns this
|
|
63
|
+
* shape from the GraphQL response; the walker doesn't know the
|
|
64
|
+
* specific GraphQL field path so the inputs decouple the two
|
|
65
|
+
* concerns.
|
|
66
|
+
*/
|
|
67
|
+
export interface PaginatedPage<T> {
|
|
68
|
+
readonly items: readonly T[];
|
|
69
|
+
/**
|
|
70
|
+
* `null` when the cursor walk is exhausted; a non-empty string
|
|
71
|
+
* otherwise. Monday's contract: the cursor returned alongside a
|
|
72
|
+
* page is the cursor for the *next* page, not a token covering
|
|
73
|
+
* the page just returned.
|
|
74
|
+
*/
|
|
75
|
+
readonly cursor: string | null;
|
|
76
|
+
}
|
|
77
|
+
export interface PaginateInputs<T, R> {
|
|
78
|
+
/**
|
|
79
|
+
* Issues the initial `items_page` request with the supplied
|
|
80
|
+
* effective limit. Variables shape is the caller's concern;
|
|
81
|
+
* `effectiveLimit` is the per-request `limit:` to send on the
|
|
82
|
+
* GraphQL query. Codex M4 pass-2 §1: when `--limit < pageSize`
|
|
83
|
+
* the walker shrinks the request to the remaining budget so
|
|
84
|
+
* Monday's cursor doesn't advance past un-emitted rows.
|
|
85
|
+
*/
|
|
86
|
+
readonly fetchInitial: (effectiveLimit: number) => Promise<MondayResponse<R>>;
|
|
87
|
+
/**
|
|
88
|
+
* Issues a `next_items_page(cursor:, limit:)` request with the
|
|
89
|
+
* supplied effective limit. Same rationale as `fetchInitial`.
|
|
90
|
+
*/
|
|
91
|
+
readonly fetchNext: (cursor: string, effectiveLimit: number) => Promise<MondayResponse<R>>;
|
|
92
|
+
/**
|
|
93
|
+
* Projects a Monday response into the items + next cursor for one
|
|
94
|
+
* page. Returns `cursor: null` to terminate the walk.
|
|
95
|
+
*/
|
|
96
|
+
readonly extractPage: (response: MondayResponse<R>) => PaginatedPage<T>;
|
|
97
|
+
/**
|
|
98
|
+
* Sort key for the per-page §3.1 #8 ascending-by-ID rule. The
|
|
99
|
+
* walker calls this once per item; small projector, runs in
|
|
100
|
+
* memory only.
|
|
101
|
+
*/
|
|
102
|
+
readonly getId: (item: T) => string;
|
|
103
|
+
/**
|
|
104
|
+
* Honour the `--all` flag. False → fetch the first page only and
|
|
105
|
+
* return its cursor on the result (caller surfaces `next_cursor`
|
|
106
|
+
* on `meta`).
|
|
107
|
+
*/
|
|
108
|
+
readonly all: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* `--limit N` cap on total items collected across the walk. The
|
|
111
|
+
* walker stops mid-page when the cap is reached; the in-flight
|
|
112
|
+
* cursor is preserved on the result so the caller still surfaces
|
|
113
|
+
* `next_cursor` accurately. Undefined / 0 / negative → no cap.
|
|
114
|
+
*/
|
|
115
|
+
readonly limit?: number;
|
|
116
|
+
/**
|
|
117
|
+
* Page size used for the GraphQL request — surfaced so the walker
|
|
118
|
+
* can apply the §2.4 ≤500 ceiling once and leave callers passing
|
|
119
|
+
* any value through. Defaults to {@link DEFAULT_PAGE_SIZE}.
|
|
120
|
+
*/
|
|
121
|
+
readonly pageSize?: number;
|
|
122
|
+
/**
|
|
123
|
+
* Streaming hook for the NDJSON output mode (§6.3). Called once
|
|
124
|
+
* per emitted item, in the per-page sorted order. `await`ed so
|
|
125
|
+
* a slow downstream consumer (a piped `jq`) backpressures the
|
|
126
|
+
* walker — same shape as Node's writable stream.
|
|
127
|
+
*/
|
|
128
|
+
readonly onItem?: (item: T) => void | Promise<void>;
|
|
129
|
+
/**
|
|
130
|
+
* Clock source for cursor-age tracking. Defaults to `Date.now()`
|
|
131
|
+
* via `() => new Date()`; tests inject a deterministic clock to
|
|
132
|
+
* exercise the 60-min expiry boundary without wall-clock waits.
|
|
133
|
+
*/
|
|
134
|
+
readonly now?: () => Date;
|
|
135
|
+
}
|
|
136
|
+
export interface PaginationWalkResult<T, R> {
|
|
137
|
+
readonly items: readonly T[];
|
|
138
|
+
/**
|
|
139
|
+
* The final response — used for `meta.complexity`. Always present
|
|
140
|
+
* (even if the walk fetched a single page). Null only when the
|
|
141
|
+
* walk fetched zero pages, which the walker doesn't produce: at
|
|
142
|
+
* least the initial request runs.
|
|
143
|
+
*/
|
|
144
|
+
readonly lastResponse: MondayResponse<R>;
|
|
145
|
+
/**
|
|
146
|
+
* Carries the cursor for the *next* page when more remains; null
|
|
147
|
+
* when the walk has run to exhaustion (Monday returned `null`) or
|
|
148
|
+
* stopped early on `--limit`. The walker does *not* pre-eject a
|
|
149
|
+
* cursor when `--all` ran to completion — agents reading
|
|
150
|
+
* `meta.next_cursor: null` know the walk is exhausted.
|
|
151
|
+
*/
|
|
152
|
+
readonly nextCursor: string | null;
|
|
153
|
+
/**
|
|
154
|
+
* `true` when `--limit` short-circuited the walk on a still-full
|
|
155
|
+
* page, OR when `--all` was off and the initial page returned a
|
|
156
|
+
* non-null cursor. `false` when the walk ran to exhaustion.
|
|
157
|
+
*/
|
|
158
|
+
readonly hasMore: boolean;
|
|
159
|
+
/** Pages actually fetched (1 = initial only). */
|
|
160
|
+
readonly pagesFetched: number;
|
|
161
|
+
/** §6.1 source — always `'live'` for cursor walks. */
|
|
162
|
+
readonly source: 'live';
|
|
163
|
+
/** Always null for cursor walks (no cache hits). */
|
|
164
|
+
readonly cacheAgeSeconds: number | null;
|
|
165
|
+
/**
|
|
166
|
+
* `meta.complexity` from the *last* response that came back —
|
|
167
|
+
* picks the freshest budget snapshot. Null when --verbose wasn't
|
|
168
|
+
* set (Monday only includes complexity when the operation
|
|
169
|
+
* selects it).
|
|
170
|
+
*/
|
|
171
|
+
readonly complexity: Complexity | null;
|
|
172
|
+
/**
|
|
173
|
+
* Warnings the walker may surface. Empty in v0.1; reserved so
|
|
174
|
+
* future cap-style truncation (e.g. an aggregate per-walk hour
|
|
175
|
+
* limit) can fold a warning in without changing the result type.
|
|
176
|
+
*/
|
|
177
|
+
readonly warnings: readonly Warning[];
|
|
178
|
+
/**
|
|
179
|
+
* Total items returned to the caller (after `--limit`). Mirrors
|
|
180
|
+
* `items.length` when streaming isn't used, but kept as an
|
|
181
|
+
* explicit slot so a future per-item filter (skipping malformed
|
|
182
|
+
* rows) can report a smaller surface than `items.length` would
|
|
183
|
+
* imply.
|
|
184
|
+
*/
|
|
185
|
+
readonly totalReturned: number;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Walks a cursor-paginated Monday endpoint. See module header for
|
|
189
|
+
* the §5.6 contract. Throws on the first response that maps to a
|
|
190
|
+
* `stale_cursor` error; the thrown `ApiError` has `details` enriched
|
|
191
|
+
* with `cursor_age_seconds`, `items_returned_so_far`, and
|
|
192
|
+
* `last_item_id`.
|
|
193
|
+
*/
|
|
194
|
+
export declare const paginate: <T, R>(inputs: PaginateInputs<T, R>) => Promise<PaginationWalkResult<T, R>>;
|
|
195
|
+
/**
|
|
196
|
+
* Whether the cursor age has exceeded the 60-min lifetime. Exposed
|
|
197
|
+
* as a pure helper so tests can pin the threshold without driving
|
|
198
|
+
* the full walker.
|
|
199
|
+
*/
|
|
200
|
+
export declare const isCursorExpired: (ageSeconds: number) => boolean;
|
|
201
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources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
+
* Cursor-based pagination walker (`cli-design.md` §2.4 / §5.6,
|
|
3
|
+
* `v0.1-plan.md` §3 M4).
|
|
4
|
+
*
|
|
5
|
+
* The cursor walker is fundamentally different from `walk-pages.ts`'s
|
|
6
|
+
* page-based shape: Monday issues a 60-minute cursor on the *initial*
|
|
7
|
+
* `items_page` call and a stale cursor returns
|
|
8
|
+
* `INVALID_CURSOR_EXCEPTION` (mapped to `stale_cursor` by
|
|
9
|
+
* `api/errors.ts`). The §5.6 contract is **fail-fast on expiry —
|
|
10
|
+
* never silently re-issue the initial query**, because a re-issue
|
|
11
|
+
* between page N and the resumed walk can duplicate or skip items
|
|
12
|
+
* (board mutated, item archived, etc.). That's silent corruption;
|
|
13
|
+
* the design rejects it explicitly.
|
|
14
|
+
*
|
|
15
|
+
* **Result-type discipline (§14 M3 lesson, prophylactic adoption).**
|
|
16
|
+
* `PaginationWalkResult` carries every §6.1 + §6.3 meta slot from
|
|
17
|
+
* day one — `source`, `cacheAgeSeconds`, `complexity`, `warnings`,
|
|
18
|
+
* `nextCursor`, `hasMore`, `totalReturned`. M3's
|
|
19
|
+
* `BoardMetadataLoadResult` and `ResolveColumnWithRefreshResult`
|
|
20
|
+
* both under-budgeted their meta surface and grew during review;
|
|
21
|
+
* M4 starts complete. Cursor-paginated reads always run live
|
|
22
|
+
* (`source: 'live'`, `cacheAgeSeconds: null`) — the fields are
|
|
23
|
+
* present anyway so callers spread them without thinking about the
|
|
24
|
+
* branch.
|
|
25
|
+
*
|
|
26
|
+
* **Streaming hook (`onItem`).** Required for `item list --output
|
|
27
|
+
* ndjson` per §6.3 — items emit per-arrival, not after the whole
|
|
28
|
+
* walk collects. The walker calls `onItem` once per item *in
|
|
29
|
+
* per-page-sorted order* (the sort-by-ID pass per §3.1 #8 happens
|
|
30
|
+
* before the callback fires), then the trailer (the §6.3 `_meta`
|
|
31
|
+
* line) carries `next_cursor` / `has_more` / `total_returned`. If
|
|
32
|
+
* a stale cursor fires mid-walk, `onItem` has already emitted the
|
|
33
|
+
* pre-failure items; the caller produces the error envelope on
|
|
34
|
+
* stderr as documented in §6.3 / §6.5.
|
|
35
|
+
*
|
|
36
|
+
* **Cursor lifetime tracking.** The walker reads `now: () => Date`
|
|
37
|
+
* from inputs — production wires `ctx.clock`, tests inject a
|
|
38
|
+
* deterministic clock. The age is measured from the `now()` value
|
|
39
|
+
* captured *before* the initial request fires (so the test clock
|
|
40
|
+
* controls expiry deterministically; no wall-clock waits). On a
|
|
41
|
+
* mid-walk `stale_cursor` from Monday, the walker enriches the
|
|
42
|
+
* error's `details` with `cursor_age_seconds` /
|
|
43
|
+
* `items_returned_so_far` / `last_item_id` per §5.6.
|
|
44
|
+
*/
|
|
45
|
+
import { ApiError } from '../utils/errors.js';
|
|
46
|
+
import { sortByIdAsc } from './sort.js';
|
|
47
|
+
/**
|
|
48
|
+
* Monday's cursor lifetime per `cli-design.md` §2.4 / §5.6.
|
|
49
|
+
* Exported so a `--cursor-lifetime-seconds` flag (if ever added)
|
|
50
|
+
* can shadow it; for v0.1 it's a constant.
|
|
51
|
+
*/
|
|
52
|
+
export const CURSOR_LIFETIME_SECONDS = 60 * 60;
|
|
53
|
+
/**
|
|
54
|
+
* Default page size — Monday caps at 500 (§2.4). Most agent queries
|
|
55
|
+
* fit well under this; the walker's caller can override via
|
|
56
|
+
* `pageSize` to reduce per-request payload size when items carry a
|
|
57
|
+
* lot of column-value data.
|
|
58
|
+
*/
|
|
59
|
+
export const DEFAULT_PAGE_SIZE = 100;
|
|
60
|
+
const wallClock = () => new Date();
|
|
61
|
+
/**
|
|
62
|
+
* Walks a cursor-paginated Monday endpoint. See module header for
|
|
63
|
+
* the §5.6 contract. Throws on the first response that maps to a
|
|
64
|
+
* `stale_cursor` error; the thrown `ApiError` has `details` enriched
|
|
65
|
+
* with `cursor_age_seconds`, `items_returned_so_far`, and
|
|
66
|
+
* `last_item_id`.
|
|
67
|
+
*/
|
|
68
|
+
export const paginate = async (inputs) => {
|
|
69
|
+
const now = inputs.now ?? wallClock;
|
|
70
|
+
const startedAt = now();
|
|
71
|
+
const limit = (inputs.limit ?? 0) > 0 ? inputs.limit : undefined;
|
|
72
|
+
// Use the page size for diagnostics only — the actual request body
|
|
73
|
+
// is the caller's concern (it lives on `fetchInitial` / `fetchNext`).
|
|
74
|
+
// We still cap at 500 here as a forward-looking sanity check; if a
|
|
75
|
+
// future caller passes 1000, we want a deterministic crash, not a
|
|
76
|
+
// silent Monday-side rejection that's harder to debug.
|
|
77
|
+
const pageSize = Math.min(inputs.pageSize ?? DEFAULT_PAGE_SIZE, 500);
|
|
78
|
+
if (pageSize <= 0) {
|
|
79
|
+
throw new ApiError('internal_error', `paginate: pageSize must be positive, got ${String(pageSize)}`);
|
|
80
|
+
}
|
|
81
|
+
const collected = [];
|
|
82
|
+
let pagesFetched;
|
|
83
|
+
let lastResponse;
|
|
84
|
+
let cursor;
|
|
85
|
+
/**
|
|
86
|
+
* Per-call effective limit = `min(pageSize, remainingBudget)` so
|
|
87
|
+
* Monday's cursor advances over exactly the rows the walker emits.
|
|
88
|
+
* Without this, `--limit 2 --page-size 100` fetches 100 items,
|
|
89
|
+
* emits 2, and reports a cursor pointing past row 100 — agents
|
|
90
|
+
* resuming would skip rows 3-100 (Codex M4 pass-2 §1).
|
|
91
|
+
*/
|
|
92
|
+
const callLimit = (collectedSoFar) => {
|
|
93
|
+
if (limit === undefined)
|
|
94
|
+
return pageSize;
|
|
95
|
+
const remaining = limit - collectedSoFar;
|
|
96
|
+
return remaining < pageSize ? remaining : pageSize;
|
|
97
|
+
};
|
|
98
|
+
// Initial request always runs. Wrap so a stale_cursor on the
|
|
99
|
+
// *initial* request still gets the standard envelope (Monday is
|
|
100
|
+
// unlikely to return that here — you'd have to re-use a cursor
|
|
101
|
+
// across processes — but the contract is symmetric).
|
|
102
|
+
try {
|
|
103
|
+
const first = await fetchPage(() => inputs.fetchInitial(callLimit(0)), inputs.extractPage);
|
|
104
|
+
lastResponse = first.response;
|
|
105
|
+
pagesFetched = 1;
|
|
106
|
+
const sorted = sortByIdAsc(first.page.items, inputs.getId);
|
|
107
|
+
const firstOutcome = await emitItems(sorted, collected, limit, inputs.onItem);
|
|
108
|
+
cursor = first.page.cursor;
|
|
109
|
+
// Caller asked for one page only. Surface the cursor verbatim;
|
|
110
|
+
// hasMore reflects whether Monday says there's more to read OR
|
|
111
|
+
// whether `--limit` truncated the page.
|
|
112
|
+
if (!inputs.all) {
|
|
113
|
+
return finish(collected, lastResponse, cursor, cursor !== null || firstOutcome.truncated, pagesFetched);
|
|
114
|
+
}
|
|
115
|
+
// `--limit` short-circuited mid-page (or exactly at boundary).
|
|
116
|
+
// Surface the in-flight cursor so the caller can resume; emit
|
|
117
|
+
// `hasMore: true` even when `next_cursor` is null because the
|
|
118
|
+
// truncation itself means more rows exist on this page.
|
|
119
|
+
if (limit !== undefined && collected.length >= limit) {
|
|
120
|
+
return finish(collected, lastResponse, cursor, cursor !== null || firstOutcome.truncated, pagesFetched);
|
|
121
|
+
}
|
|
122
|
+
// Walk until cursor exhaustion or limit hit.
|
|
123
|
+
while (cursor !== null) {
|
|
124
|
+
const cursorAt = cursor;
|
|
125
|
+
try {
|
|
126
|
+
const next = await fetchPage(() => inputs.fetchNext(cursorAt, callLimit(collected.length)), inputs.extractPage);
|
|
127
|
+
lastResponse = next.response;
|
|
128
|
+
pagesFetched++;
|
|
129
|
+
const sortedNext = sortByIdAsc(next.page.items, inputs.getId);
|
|
130
|
+
const outcome = await emitItems(sortedNext, collected, limit, inputs.onItem);
|
|
131
|
+
cursor = next.page.cursor;
|
|
132
|
+
if (limit !== undefined && collected.length >= limit) {
|
|
133
|
+
return finish(collected, lastResponse, cursor, cursor !== null || outcome.truncated, pagesFetched);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
if (err instanceof ApiError && err.code === 'stale_cursor') {
|
|
138
|
+
throw enrichStaleCursor(err, {
|
|
139
|
+
startedAt,
|
|
140
|
+
now,
|
|
141
|
+
collected,
|
|
142
|
+
getId: inputs.getId,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
throw err;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return finish(collected, lastResponse, null, false, pagesFetched);
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
if (err instanceof ApiError && err.code === 'stale_cursor') {
|
|
152
|
+
throw enrichStaleCursor(err, {
|
|
153
|
+
startedAt,
|
|
154
|
+
now,
|
|
155
|
+
collected,
|
|
156
|
+
getId: inputs.getId,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
throw err;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
const fetchPage = async (fetcher, extract) => {
|
|
163
|
+
const response = await fetcher();
|
|
164
|
+
return { response, page: extract(response) };
|
|
165
|
+
};
|
|
166
|
+
const emitItems = async (pageItems, collected, limit, onItem) => {
|
|
167
|
+
for (let i = 0; i < pageItems.length; i++) {
|
|
168
|
+
if (limit !== undefined && collected.length >= limit) {
|
|
169
|
+
// Items past index i are unconsumed — page had more than the
|
|
170
|
+
// remaining budget allowed.
|
|
171
|
+
return { truncated: i < pageItems.length };
|
|
172
|
+
}
|
|
173
|
+
const item = pageItems[i];
|
|
174
|
+
collected.push(item);
|
|
175
|
+
if (onItem !== undefined) {
|
|
176
|
+
await onItem(item);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return { truncated: false };
|
|
180
|
+
};
|
|
181
|
+
const finish = (items, lastResponse, nextCursor, hasMore, pagesFetched) => ({
|
|
182
|
+
items,
|
|
183
|
+
lastResponse,
|
|
184
|
+
nextCursor,
|
|
185
|
+
hasMore,
|
|
186
|
+
pagesFetched,
|
|
187
|
+
source: 'live',
|
|
188
|
+
cacheAgeSeconds: null,
|
|
189
|
+
complexity: lastResponse.complexity,
|
|
190
|
+
warnings: [],
|
|
191
|
+
totalReturned: items.length,
|
|
192
|
+
});
|
|
193
|
+
const enrichStaleCursor = (err, ctx) => {
|
|
194
|
+
const ageMs = ctx.now().getTime() - ctx.startedAt.getTime();
|
|
195
|
+
const cursor_age_seconds = Math.max(0, Math.floor(ageMs / 1000));
|
|
196
|
+
const last = ctx.collected[ctx.collected.length - 1];
|
|
197
|
+
const last_item_id = last === undefined ? null : ctx.getId(last);
|
|
198
|
+
const merged = {
|
|
199
|
+
...(err.details ?? {}),
|
|
200
|
+
cursor_age_seconds,
|
|
201
|
+
cursor_lifetime_seconds: CURSOR_LIFETIME_SECONDS,
|
|
202
|
+
items_returned_so_far: ctx.collected.length,
|
|
203
|
+
last_item_id,
|
|
204
|
+
};
|
|
205
|
+
// Re-throw with the same code/message but enriched details.
|
|
206
|
+
// Keeping the original message verbatim so agents key off `code`
|
|
207
|
+
// and humans see Monday's prose.
|
|
208
|
+
return new ApiError('stale_cursor', err.message, {
|
|
209
|
+
...(err.httpStatus === undefined ? {} : { httpStatus: err.httpStatus }),
|
|
210
|
+
...(err.mondayCode === undefined ? {} : { mondayCode: err.mondayCode }),
|
|
211
|
+
...(err.requestId === undefined ? {} : { requestId: err.requestId }),
|
|
212
|
+
retryable: false,
|
|
213
|
+
details: merged,
|
|
214
|
+
cause: err,
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Whether the cursor age has exceeded the 60-min lifetime. Exposed
|
|
219
|
+
* as a pure helper so tests can pin the threshold without driving
|
|
220
|
+
* the full walker.
|
|
221
|
+
*/
|
|
222
|
+
export const isCursorExpired = (ageSeconds) => ageSeconds >= CURSOR_LIFETIME_SECONDS;
|
|
223
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/api/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,W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AAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC;QACvE,GAAG,CAAC,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC;QACpE,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,MAAM;QACf,KAAK,EAAE,GAAG;KACX,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,UAAkB,EAAW,EAAE,CAC7D,UAAU,IAAI,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** A per-target result inside `data.results: [...]`. */
|
|
2
|
+
export interface PartialSuccessResult {
|
|
3
|
+
readonly ok: boolean;
|
|
4
|
+
readonly error?: {
|
|
5
|
+
readonly code: string;
|
|
6
|
+
readonly message: string;
|
|
7
|
+
};
|
|
8
|
+
readonly [key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface PartialSuccessEnvelopeData {
|
|
11
|
+
readonly results: readonly PartialSuccessResult[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Sequential per-target dispatch with shared error decoration. Each
|
|
15
|
+
* dispatch failure is captured into the result record's `error: {code,
|
|
16
|
+
* message}` slot rather than thrown — a per-target failure doesn't
|
|
17
|
+
* abort the loop. The whole-call contract: if dispatch ran, the
|
|
18
|
+
* envelope is `ok: true` regardless of per-target outcomes.
|
|
19
|
+
*
|
|
20
|
+
* Errors thrown that aren't `MondayCliError` propagate up — those are
|
|
21
|
+
* programmer bugs, not Monday-side failures, and the runner's catch-
|
|
22
|
+
* all maps them to `internal_error`.
|
|
23
|
+
*/
|
|
24
|
+
export interface DispatchOneTargetInputs<TargetId extends string> {
|
|
25
|
+
readonly targetId: TargetId;
|
|
26
|
+
}
|
|
27
|
+
export declare const dispatchSequential: <TargetId extends string>(targets: readonly TargetId[], idField: string, dispatch: (inputs: DispatchOneTargetInputs<TargetId>) => Promise<void>) => Promise<readonly PartialSuccessResult[]>;
|
|
28
|
+
//# sourceMappingURL=partial-success-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partial-success-mutation.d.ts","sourceRoot":"","sources":["../../src/api/partial-success-mutation.ts"],"names":[],"mappings":"AAuBA,wDAAwD;AACxD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE;QACf,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;KAC1B,CAAC;IAIF,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,OAAO,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACnD;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,uBAAuB,CAAC,QAAQ,SAAS,MAAM;IAC9D,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,eAAO,MAAM,kBAAkB,GAAU,QAAQ,SAAS,MAAM,EAC9D,SAAS,SAAS,QAAQ,EAAE,EAC5B,SAAS,MAAM,EACf,UAAU,CAAC,MAAM,EAAE,uBAAuB,CAAC,QAAQ,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,KACrE,OAAO,CAAC,SAAS,oBAAoB,EAAE,CAqCzC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Partial-success mutation envelope builder (`cli-design.md` §6.4 +
|
|
3
|
+
* `v0.2-plan.md` §1 universal partial-success rule).
|
|
4
|
+
*
|
|
5
|
+
* Multi-target mutations (M13 `update clear-all`; M14 `workspace
|
|
6
|
+
* add-users` / `remove-users`; M15 `board add-users`) dispatch one
|
|
7
|
+
* wire call per target inside a sequential loop. The CLI emits **one
|
|
8
|
+
* success envelope** (`ok: true`) with per-target outcomes in
|
|
9
|
+
* `data.results: [...]`; each per-target record carries
|
|
10
|
+
* `{<target_id_field>: string, ok: true | false, error?: { code,
|
|
11
|
+
* message }}`. The id-field name is verb-specific (parameterised here
|
|
12
|
+
* via `idField`) so the JSON is self-documenting — `update_id` for
|
|
13
|
+
* `update clear-all`, `user_id` for the add/remove-users family.
|
|
14
|
+
*
|
|
15
|
+
* **Universal rule**: the envelope is always `ok: true` when dispatch
|
|
16
|
+
* ran. Top-level `ok: false` is reserved for whole-call failure
|
|
17
|
+
* (couldn't reach API, couldn't resolve any target before the loop
|
|
18
|
+
* began, an unrecoverable validation error before dispatch). All-
|
|
19
|
+
* failed-but-each-call-attempted is still `ok: true` — the agent
|
|
20
|
+
* reads `data.results` to determine outcomes.
|
|
21
|
+
*/
|
|
22
|
+
import { MondayCliError } from '../utils/errors.js';
|
|
23
|
+
export const dispatchSequential = async (targets, idField, dispatch) => {
|
|
24
|
+
const results = [];
|
|
25
|
+
for (const targetId of targets) {
|
|
26
|
+
try {
|
|
27
|
+
await dispatch({ targetId });
|
|
28
|
+
// Build the result with the dynamic id-field name. Property
|
|
29
|
+
// assignment preserves insertion order (`<idField>` first, then
|
|
30
|
+
// `ok`) so the JSON shape stays stable across runs.
|
|
31
|
+
const ok = {
|
|
32
|
+
[idField]: targetId,
|
|
33
|
+
ok: true,
|
|
34
|
+
};
|
|
35
|
+
results.push(ok);
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
if (err instanceof MondayCliError) {
|
|
39
|
+
// Codex M14 round-2 F1: `internal_error` codes signal CLI
|
|
40
|
+
// bugs or Monday-side schema drift (e.g. response missing
|
|
41
|
+
// the mutation root key). Those are whole-call failures
|
|
42
|
+
// — papering over them with a per-record slot would hide
|
|
43
|
+
// the malformed-response signal that agents need to know
|
|
44
|
+
// about. Re-throw so the runner's catch-all surfaces it
|
|
45
|
+
// as the documented internal_error envelope.
|
|
46
|
+
if (err.code === 'internal_error')
|
|
47
|
+
throw err;
|
|
48
|
+
const failed = {
|
|
49
|
+
[idField]: targetId,
|
|
50
|
+
ok: false,
|
|
51
|
+
error: { code: err.code, message: err.message },
|
|
52
|
+
};
|
|
53
|
+
results.push(failed);
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
// Non-CLI errors are programmer bugs — let the runner catch-all
|
|
57
|
+
// surface as `internal_error`.
|
|
58
|
+
throw err;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return results;
|
|
62
|
+
};
|
|
63
|
+
// The output schema lives per-verb because the id-field key (`update_
|
|
64
|
+
// id` / `user_id` / etc.) is dynamic and zod doesn't synthesise
|
|
65
|
+
// per-call object keys cleanly. M14 will re-evaluate whether a schema
|
|
66
|
+
// factory pulls weight; today each consumer writes a 6-line zod
|
|
67
|
+
// schema and pays nothing for the duplication.
|
|
68
|
+
//# sourceMappingURL=partial-success-mutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partial-success-mutation.js","sourceRoot":"","sources":["../../src/api/partial-success-mutation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAkCpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EACrC,OAA4B,EAC5B,OAAe,EACf,QAAsE,EAC5B,EAAE;IAC5C,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,KAAK,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC;YACH,MAAM,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;YAC7B,4DAA4D;YAC5D,gEAAgE;YAChE,oDAAoD;YACpD,MAAM,EAAE,GAAyB;gBAC/B,CAAC,OAAO,CAA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